Commit 278167fd authored by Luis Chamberlain's avatar Luis Chamberlain Committed by Jens Axboe

block: add __must_check for *add_disk*() callers

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: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20211110002949.999380-1-mcgrof@kernel.orgSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent ecaf97f4
...@@ -394,7 +394,7 @@ static void disk_scan_partitions(struct gendisk *disk) ...@@ -394,7 +394,7 @@ static void disk_scan_partitions(struct gendisk *disk)
* This function registers the partitioning information in @disk * This function registers the partitioning information in @disk
* with the kernel. * with the kernel.
*/ */
int device_add_disk(struct device *parent, struct gendisk *disk, int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
const struct attribute_group **groups) const struct attribute_group **groups)
{ {
...@@ -544,7 +544,7 @@ int device_add_disk(struct device *parent, struct gendisk *disk, ...@@ -544,7 +544,7 @@ int device_add_disk(struct device *parent, struct gendisk *disk,
out_free_ext_minor: out_free_ext_minor:
if (disk->major == BLOCK_EXT_MAJOR) if (disk->major == BLOCK_EXT_MAJOR)
blk_free_ext_minor(disk->first_minor); 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); EXPORT_SYMBOL(device_add_disk);
......
...@@ -205,9 +205,9 @@ static inline dev_t disk_devt(struct gendisk *disk) ...@@ -205,9 +205,9 @@ static inline dev_t disk_devt(struct gendisk *disk)
void disk_uevent(struct gendisk *disk, enum kobject_action action); void disk_uevent(struct gendisk *disk, enum kobject_action action);
/* block/genhd.c */ /* block/genhd.c */
int device_add_disk(struct device *parent, struct gendisk *disk, int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
const struct attribute_group **groups); const struct attribute_group **groups);
static inline int add_disk(struct gendisk *disk) static inline int __must_check add_disk(struct gendisk *disk)
{ {
return device_add_disk(NULL, disk, NULL); return device_add_disk(NULL, disk, NULL);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment