From patchwork Sat Sep 4 01:39:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 12475383 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7EBFC4332F for ; Sat, 4 Sep 2021 01:39:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CC43E6101A for ; Sat, 4 Sep 2021 01:39:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351088AbhIDBkq (ORCPT ); Fri, 3 Sep 2021 21:40:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351057AbhIDBko (ORCPT ); Fri, 3 Sep 2021 21:40:44 -0400 Received: from bombadil.infradead.org (unknown [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E4EBC061575; Fri, 3 Sep 2021 18:39:44 -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=U7qsjNpZBkuuNQ3f0wVuSbAq2dxl5cyjOFVGEywo1xo=; b=RPNeY5S553G86UCtACRRsuReWA Pf7d8IkN00oqTTx3vsnZiaK2pyXsMjqkQ/QhL6BzprrfTQEe42gLBIb59YZADPtuV9Tn8BuYUQpTB N+u3oumOvhPHYeNzsFKK86V6ZEz96h7HT7Vn4+rCxdV53DFo4onHN+6/eNu9zzyNxravRpzP9C+gC 19/flcXayVqI8laB77OfwS8mF83K9UuV3xA9mw7+l3L7V1oH0yatBvcyhiYnrUW84ZGMzdovHPofb Ra/b5dENtOvSiMXA8Z6v2niqRYzqW0j41STDDxLuQFc45jgRHHt3BJB0yM/wRLJ1c2MSxEewEFtTc F6qEPVsw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mMKeb-00DLzv-7F; Sat, 04 Sep 2021 01:39:33 +0000 From: Luis Chamberlain To: axboe@kernel.dk, hch@lst.de, 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 2/2] block: add __must_check for *add_disk*() callers Date: Fri, 3 Sep 2021 18:39:32 -0700 Message-Id: <20210904013932.3182778-3-mcgrof@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210904013932.3182778-1-mcgrof@kernel.org> References: <20210904013932.3182778-1-mcgrof@kernel.org> MIME-Version: 1.0 Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-scsi@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 c4836296a974..4c80e6c3d8dd 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -383,8 +383,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); @@ -529,7 +529,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 5828ecda5c49..8d78d36c424e 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -214,9 +214,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); }