Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp801597pxb; Thu, 21 Oct 2021 09:43:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9QjYbVWDTt+6i4Pu/eDRLDMi5Ht1gZQXoiw1QzpjDX9dmJy48STIqxz+T3tFvB8STzKUh X-Received: by 2002:a05:6402:190f:: with SMTP id e15mr9310024edz.310.1634834621795; Thu, 21 Oct 2021 09:43:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634834621; cv=none; d=google.com; s=arc-20160816; b=Duwg37WtVVmbA1Lm+qF872PKyDJXUYdt9d0xl68Rnu0qzjwsIc8QtsH8c0N4GofoEa mDolyMN284rn1jkieXgW2Ti+NdNMkNKXVvVSEH4CjTkXbueLhVEKOSqkq9wr3wSW2fLq jPSSSELQdIREeKFOxac/nqE8xA41EDb8Gt487FsicO/tspDmn4VWZMR8XoAl1ll5+LQH mtVDMtzf9KXKIywKxRwOO5bRwrbX2yMZ7nRigv5KjsXxqs6PIzp70c7PDRXUQ65ai91u 8oGCYXjL0KdjhFB/H27lVHm5FWdT5/v86zpLfUwgPLHhSMBHtLaeCKaVhzbbsgW0NQi/ cIdA== 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 :dkim-signature; bh=5Fa6osgzG4VxZaX6kVT87k4aCBY3SA+fIXDyr0H5bnE=; b=mkvkeYhKKHRRkPJx7iJWczAsMLRX+1fMAE8SIfQ+A8bvtMzoq7IOx9NUlbFyO8Cajq xp4i+Pcyzh+YQfPgjNChqlcdOAwj0Ln5HOQG0Mht1AXCTCXZyUDAGKG6+lbK1eF8p3Qb qCR4daa6CS69ndY1ZeOI+JpXhzQmzZnfhXvcnwS2mnqVMZuJUYYWo8nM7RV38ztPr7+x khddy8jBGbCN0YNBtxXUwLuIfUKRxW/UwV9FqWt6G9gX7Xq7/ySS+O5z8mYMNJU+tCze /Fz5+L+e/ML2mFeJtxUl+dPvoVCaRTlgFyuipSsNvT2hCdg3TKL4KB9TBMLwdiyR1HUX AYBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=fWW+67KN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ds3si10014173ejc.610.2021.10.21.09.43.17; Thu, 21 Oct 2021 09:43:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=fWW+67KN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231933AbhJUQlW (ORCPT + 99 others); Thu, 21 Oct 2021 12:41:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229702AbhJUQlW (ORCPT ); Thu, 21 Oct 2021 12:41:22 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19E64C061764; Thu, 21 Oct 2021 09:39:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=5Fa6osgzG4VxZaX6kVT87k4aCBY3SA+fIXDyr0H5bnE=; b=fWW+67KN3XFJuIVdLP4+f1eJyf OR/jzg6Rs5PFWWNWnsCldxuJ0lRuI967CxMhJdBVWUsqXs8SMf5X/+HGSk11k6vPQcbMndfz1J2Gd N3nVElpGhlnLbq82g/XXeTs+R/SKFqcrTcV5MEpSM0eY6RLn8kUxgRu9Rp2Q3erouKJNi/VXd3fV7 D/KIUulfZ7DfcjtSxa5QIF1iOrrXiWuK7aOdFBXjNiQb2+Th+I8rC4bd7uyEVeUsQ8O/24QjHKRqV qJqWoDVDYmIjRW0KMH4ZhozF2irk/8OC8F1co9A8cnrcfTxzm0zvro1N8+ydfi8U8qalRumDg+WC+ 6XNRJh7A==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdb5m-008OZ0-1p; Thu, 21 Oct 2021 16:38:58 +0000 From: Luis Chamberlain To: axboe@kernel.dk, hch@lst.de, penguin-kernel@i-love.sakura.ne.jp, schmitzmic@gmail.com, efremov@linux.com, song@kernel.org, jejb@linux.ibm.com, martin.petersen@oracle.com, viro@zeniv.linux.org.uk, hare@suse.de, jack@suse.cz, ming.lei@redhat.com, tj@kernel.org Cc: linux-raid@vger.kernel.org, linux-scsi@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Luis Chamberlain Subject: [PATCH v3 3/3] block: add __must_check for *add_disk*() callers Date: Thu, 21 Oct 2021 09:38:56 -0700 Message-Id: <20211021163856.2000993-4-mcgrof@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211021163856.2000993-1-mcgrof@kernel.org> References: <20211021163856.2000993-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that we have done a spring cleaning on all drivers and added error checking / handling, let's keep it that way and ensure no new drivers fail to stick with it. Signed-off-by: Luis Chamberlain --- block/genhd.c | 6 +++--- include/linux/genhd.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index 404429e6f06c..51ceb084135a 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -397,8 +397,8 @@ static void disk_scan_partitions(struct gendisk *disk) * This function registers the partitioning information in @disk * with the kernel. */ -int device_add_disk(struct device *parent, struct gendisk *disk, - const struct attribute_group **groups) +int __must_check device_add_disk(struct device *parent, struct gendisk *disk, + const struct attribute_group **groups) { struct device *ddev = disk_to_dev(disk); @@ -543,7 +543,7 @@ int device_add_disk(struct device *parent, struct gendisk *disk, out_free_ext_minor: if (disk->major == BLOCK_EXT_MAJOR) blk_free_ext_minor(disk->first_minor); - return WARN_ON_ONCE(ret); /* keep until all callers handle errors */ + return ret; } EXPORT_SYMBOL(device_add_disk); diff --git a/include/linux/genhd.h b/include/linux/genhd.h index f805173de312..bddcb30d94c1 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -205,9 +205,9 @@ static inline dev_t disk_devt(struct gendisk *disk) void disk_uevent(struct gendisk *disk, enum kobject_action action); /* block/genhd.c */ -int device_add_disk(struct device *parent, struct gendisk *disk, - const struct attribute_group **groups); -static inline int add_disk(struct gendisk *disk) +int __must_check device_add_disk(struct device *parent, struct gendisk *disk, + const struct attribute_group **groups); +static inline int __must_check add_disk(struct gendisk *disk) { return device_add_disk(NULL, disk, NULL); } -- 2.30.2