diff options
author | Dave Airlie <airlied@redhat.com> | 2016-05-09 05:49:56 +0200 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-05-09 05:49:56 +0200 |
commit | bafb86f5bc3173479002555dea7f31d943b12332 (patch) | |
tree | 6ec94c96460faf782cdb8781339560e13e0918b0 /block/partition-generic.c | |
parent | drm/amdgpu: fix build on aarch64. (diff) | |
parent | Linux 4.6-rc7 (diff) | |
download | linux-bafb86f5bc3173479002555dea7f31d943b12332.tar.xz linux-bafb86f5bc3173479002555dea7f31d943b12332.zip |
Merge tag 'v4.6-rc7' into drm-next
Merge this back as we've built up a fair few conflicts, and I have
some newer trees to pull in.
Diffstat (limited to 'block/partition-generic.c')
-rw-r--r-- | block/partition-generic.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/block/partition-generic.c b/block/partition-generic.c index 2c6ae2aed2c4..d7eb77e1e3a8 100644 --- a/block/partition-generic.c +++ b/block/partition-generic.c @@ -361,15 +361,20 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno, goto out_del; } + err = hd_ref_init(p); + if (err) { + if (flags & ADDPART_FLAG_WHOLEDISK) + goto out_remove_file; + goto out_del; + } + /* everything is up and running, commence */ rcu_assign_pointer(ptbl->part[partno], p); /* suppress uevent if the disk suppresses it */ if (!dev_get_uevent_suppress(ddev)) kobject_uevent(&pdev->kobj, KOBJ_ADD); - - if (!hd_ref_init(p)) - return p; + return p; out_free_info: free_part_info(p); @@ -378,6 +383,8 @@ out_free_stats: out_free: kfree(p); return ERR_PTR(err); +out_remove_file: + device_remove_file(pdev, &dev_attr_whole_disk); out_del: kobject_put(p->holder_dir); device_del(pdev); |