block/ioctl.c and fs/partition/check.c: check value returned by add_partition()

Now that add_partition() has been aught to propagate errors, let's check them.

[[email protected]: coding-style fixes]
Signed-off-by: Abdel Benamrouche <[email protected]>
Cc: Jens Axboe <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Abdel Benamrouche 2008-07-25 01:48:26 -07:00 • committed by Linus Torvalds
commit 04ebd4aee5
2 changed files with 11 additions and 4 deletions

View file

@ -17,6 +17,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
long long start, length;
int part;
int i;
int err;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
@ -61,9 +62,9 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
}
}
/* all seems OK */
add_partition(disk, part, start, length, ADDPART_FLAG_NONE);
err = add_partition(disk, part, start, length, ADDPART_FLAG_NONE);
mutex_unlock(&bdev->bd_mutex);
return 0;
return err;
case BLKPG_DEL_PARTITION:
if (!disk->part[part-1])
return -ENXIO;