aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis Chamberlain <mcgrof@kernel.org>2021-07-15 03:46:28 +0000
committerLuis Chamberlain <mcgrof@kernel.org>2021-10-15 16:14:10 -0700
commit53099761729ca16d3bb36db8a8cc526f4eb08f28 (patch)
tree47b1a06fd08ae516f6717ed7c72520e93eae454c
parent0c51671b6a92b2483b9998a786141f28770263ca (diff)
downloadlinux-next-53099761729ca16d3bb36db8a8cc526f4eb08f28.tar.gz
block: add __must_check for *add_disk*() callers20211011-for-axboe-add-disk-error-handling
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 <mcgrof@kernel.org>
-rw-r--r--block/genhd.c6
-rw-r--r--include/linux/genhd.h6
2 files changed, 6 insertions, 6 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 1b24067c85d4f..5b199c3011fb3 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -395,8 +395,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);
@@ -541,7 +541,7 @@ out_disk_release_events:
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 116fa60d2d511..423a88f8f9996 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -204,9 +204,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);
}