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

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.org


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent ecaf97f4
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -394,7 +394,7 @@ 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,
int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
				 const struct attribute_group **groups)

{
@@ -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);

+3 −3
Original line number Diff line number Diff line
@@ -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,
int __must_check device_add_disk(struct device *parent, struct gendisk *disk,
				 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);
}