diff mbox series

block: add __must_check for *add_disk*() callers

Message ID 20211110002949.999380-1-mcgrof@kernel.org (mailing list archive)
State New, archived
Headers show
Series block: add __must_check for *add_disk*() callers | expand

Commit Message

Luis Chamberlain Nov. 10, 2021, 12:29 a.m. UTC
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.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---

OK this is ready now as Linus has merged all the add_disk() error
handling changes.

 block/genhd.c         | 6 +++---
 include/linux/genhd.h | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

Bart Van Assche Nov. 10, 2021, 12:54 a.m. UTC | #1
On 11/9/21 4:29 PM, Luis Chamberlain wrote:
> 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.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Jens Axboe Nov. 10, 2021, 2:20 a.m. UTC | #2
On Tue, 9 Nov 2021 16:29:49 -0800, Luis Chamberlain wrote:
> 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.
> 
> 

Applied, thanks!

[1/1] block: add __must_check for *add_disk*() callers
      commit: 278167fd2f8ffe679351605fe03e29ff3ab8db18

Best regards,
diff mbox series

Patch

diff --git a/block/genhd.c b/block/genhd.c
index ca2fbab1d425..c5392cc24d37 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -394,8 +394,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);
@@ -544,7 +544,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 462634b4b48f..74c410263113 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);
 }