The patch titled fs/partition/check.c: fix return value warning has been added to the -mm tree. Its filename is fs-partition-checkc-fix-return-value-warning.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: fs/partition/check.c: fix return value warning From: Abdel Benamrouche <draconux@xxxxxxxxx> fs/partitions/check.c:381: warning: ignoring return value of ___device_add___, declared with attribute warn_unused_result Signed-off-by: Abdel Benamrouche <draconux@xxxxxxxxx> Cc: Jens Axboe <jens.axboe@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/partitions/check.c | 25 ++++++++++++++++++++----- include/linux/genhd.h | 2 +- 2 files changed, 21 insertions(+), 6 deletions(-) diff -puN fs/partitions/check.c~fs-partition-checkc-fix-return-value-warning fs/partitions/check.c --- a/fs/partitions/check.c~fs-partition-checkc-fix-return-value-warning +++ a/fs/partitions/check.c @@ -344,18 +344,18 @@ static ssize_t whole_disk_show(struct de static DEVICE_ATTR(whole_disk, S_IRUSR | S_IRGRP | S_IROTH, whole_disk_show, NULL); -void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, int flags) +int add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, int flags) { struct hd_struct *p; int err; p = kzalloc(sizeof(*p), GFP_KERNEL); if (!p) - return; + return -ENOMEM; if (!init_part_stats(p)) { kfree(p); - return; + return -ENOMEM; } p->start_sect = start; p->nr_sects = len; @@ -376,15 +376,30 @@ void add_partition(struct gendisk *disk, /* delay uevent until 'holders' subdir is created */ p->dev.uevent_suppress = 1; - device_add(&p->dev); + err = device_add(&p->dev); + if (err) + goto out1; partition_sysfs_add_subdir(p); p->dev.uevent_suppress = 0; - if (flags & ADDPART_FLAG_WHOLEDISK) + if (flags & ADDPART_FLAG_WHOLEDISK) { err = device_create_file(&p->dev, &dev_attr_whole_disk); + if (err) + goto out2; + } /* suppress uevent if the disk supresses it */ if (!disk->dev.uevent_suppress) kobject_uevent(&p->dev.kobj, KOBJ_ADD); + + return 0; + +out2: + device_del(&p->dev); +out1: + put_device(&p->dev); + free_part_stats(p); + kfree(p); + return err; } /* Not exported, helper to add_disk(). */ diff -puN include/linux/genhd.h~fs-partition-checkc-fix-return-value-warning include/linux/genhd.h --- a/include/linux/genhd.h~fs-partition-checkc-fix-return-value-warning +++ a/include/linux/genhd.h @@ -529,7 +529,7 @@ extern dev_t blk_lookup_devt(const char extern char *disk_name (struct gendisk *hd, int part, char *buf); extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); -extern void add_partition(struct gendisk *, int, sector_t, sector_t, int); +extern int __must_check add_partition(struct gendisk *, int, sector_t, sector_t, int); extern void delete_partition(struct gendisk *, int); extern void printk_all_partitions(void); _ Patches currently in -mm which might be from draconux@xxxxxxxxx are fs-partition-checkc-fix-return-value-warning.patch fs-partition-checkc-fix-return-value-warning-v2-cleanup.patch block-ioctlc-and-fs-partition-checkc.patch block-ioctlc-and-fs-partition-checkc-checkpatch-fixes.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html