Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1211797ybe; Fri, 13 Sep 2019 12:50:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwr2fAS4f4yEiqI16VM9GktlZ6T38AhVLak/avVxEwasJvu6p71Ip7d5YCniJQY3deQNa27 X-Received: by 2002:a50:9f42:: with SMTP id b60mr50628630edf.192.1568404212905; Fri, 13 Sep 2019 12:50:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568404212; cv=none; d=google.com; s=arc-20160816; b=pElTM8FwyOcG5EAZ3kN0hHr0PCLODIZTiOsSy7N3iDbTDJK6jV4mwIY4mIXj9Hea1I fMRX65FGNAfjPuAxXR63WvyEdEPewf/8wEPD70IpxbUdHLenuCFDpwlrugOTBd4rN6ID Tl/eSgPTt7lzEkbSxZr8NQWH97X5ynaK0BGGXuxncLuA6wR1IgrCOiFh/CNjDNbdc7mj zTvAawy3b+oZEdMrbYbOFIiPULYUS1us+FL9x4iVbx1ZzF6T3zITzueKkdAN4ybBOqDL BIFoLCdVa9TkCNoDPau3d8/VMBQnv5j6jeC8dFuP4HFstjdc7b1OgWqu1ItQmMfGIPKP sbfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5rPLZ5/OzF+nuN+/wg4c0n7EJhTymb8T1pFQIFPMFV8=; b=toPqDbBVs5Ks3PnAhIXfDxXm3EwKr6qqiNnFPCeo8abmr1fDdUKPWqO9Qujyr6hxDT jkYKr35rmXEyAobeP3L4AL+F/9T9FoxoD6KClqloRQUMFpigAO4TH8PLjtJqeOp25eOe 90rIdxssoKPc5vdLLk/Gdl2e28kc889rhGanVvhDx0rM0vemjhrr0HYYb2eHs23IxgC0 QIdmxWYRGeGuMbvVKDumq/G6/PNV0gvsjwtOss20p27E1mA0CZcn7AB8iVU0vZBncCVR vjRbhwGMeVk+yfEQHHoT2Q6n6bCiyuYg5IgZb5vDi+9+OmURpk0OjDBJZ6PZmxGezUob o+ng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v16si2433410ejo.128.2019.09.13.12.49.45; Fri, 13 Sep 2019 12:50:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730014AbfIMS7D (ORCPT + 99 others); Fri, 13 Sep 2019 14:59:03 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:59182 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726822AbfIMS7C (ORCPT ); Fri, 13 Sep 2019 14:59:02 -0400 Received: from turingmachine.home (unknown [IPv6:2804:431:c7f4:5bfc:5711:794d:1c68:5ed3]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tonyk) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 24C6828F198; Fri, 13 Sep 2019 19:58:57 +0100 (BST) From: =?UTF-8?q?Andr=C3=A9=20Almeida?= To: linux-block@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: corbet@lwn.net, axboe@kernel.dk, kernel@collabora.com, krisman@collabora.com, =?UTF-8?q?Andr=C3=A9=20Almeida?= Subject: [PATCH 1/4] null_blk: do not fail the module load with zero devices Date: Fri, 13 Sep 2019 15:57:43 -0300 Message-Id: <20190913185746.337429-2-andrealmeid@collabora.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190913185746.337429-1-andrealmeid@collabora.com> References: <20190913185746.337429-1-andrealmeid@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The module load should fail only if there is something wrong with the configuration or if an error prevents it to work properly. The module should be able to be loaded with (nr_device == 0), since it will not trigger errors or be in malfunction state. Preventing loading with zero devices also breaks applications that configures this module using configfs API. Remove the nr_device check to fix this. Signed-off-by: André Almeida Fixes: f7c4ce890dd2 ("null_blk: validate the number of devices") --- drivers/block/null_blk_main.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c index ab4b87677139..be32cb5ed339 100644 --- a/drivers/block/null_blk_main.c +++ b/drivers/block/null_blk_main.c @@ -1758,10 +1758,6 @@ static int __init null_init(void) pr_err("null_blk: legacy IO path no longer available\n"); return -EINVAL; } - if (!nr_devices) { - pr_err("null_blk: invalid number of devices\n"); - return -EINVAL; - } if (g_queue_mode == NULL_Q_MQ && g_use_per_node_hctx) { if (g_submit_queues != nr_online_nodes) { pr_warn("null_blk: submit_queues param is set to %u.\n", -- 2.23.0