diff options
author | Tejun Heo <tj@kernel.org> | 2008-11-10 09:29:58 +0300 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-11-18 17:08:56 +0300 |
commit | ba32929a91fe2c0628f5be62d1597b379c8d3062 (patch) | |
tree | 09ea54ed2d2299d25b92fee6a6dde4d7527a3d37 /block/ioctl.c | |
parent | eb60fa1066622ddb2278732cf61e0c4544e82c6f (diff) | |
download | linux-ba32929a91fe2c0628f5be62d1597b379c8d3062.tar.xz |
block: make add_partition() return pointer to hd_struct
Make add_partition() return pointer to the new hd_struct on success
and ERR_PTR() value on failure. This change will be used to fix md
autodetection bug.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Neil Brown <neilb@suse.de>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/ioctl.c')
-rw-r--r-- | block/ioctl.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/block/ioctl.c b/block/ioctl.c index c832d639b6e2..d03985b04d67 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -18,7 +18,6 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user struct disk_part_iter piter; long long start, length; int partno; - int err; if (!capable(CAP_SYS_ADMIN)) return -EACCES; @@ -61,10 +60,10 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user disk_part_iter_exit(&piter); /* all seems OK */ - err = add_partition(disk, partno, start, length, - ADDPART_FLAG_NONE); + part = add_partition(disk, partno, start, length, + ADDPART_FLAG_NONE); mutex_unlock(&bdev->bd_mutex); - return err; + return IS_ERR(part) ? PTR_ERR(part) : 0; case BLKPG_DEL_PARTITION: part = disk_get_part(disk, partno); if (!part) |