aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/partitions/check.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 90bcf136a9de..633025340239 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -348,8 +348,8 @@ static ssize_t whole_disk_show(struct device *dev,
348static DEVICE_ATTR(whole_disk, S_IRUSR | S_IRGRP | S_IROTH, 348static DEVICE_ATTR(whole_disk, S_IRUSR | S_IRGRP | S_IROTH,
349 whole_disk_show, NULL); 349 whole_disk_show, NULL);
350 350
351int add_partition(struct gendisk *disk, int partno, 351struct hd_struct *add_partition(struct gendisk *disk, int partno,
352 sector_t start, sector_t len, int flags) 352 sector_t start, sector_t len, int flags)
353{ 353{
354 struct hd_struct *p; 354 struct hd_struct *p;
355 dev_t devt = MKDEV(0, 0); 355 dev_t devt = MKDEV(0, 0);
@@ -361,15 +361,15 @@ int add_partition(struct gendisk *disk, int partno,
361 361
362 err = disk_expand_part_tbl(disk, partno); 362 err = disk_expand_part_tbl(disk, partno);
363 if (err) 363 if (err)
364 return err; 364 return ERR_PTR(err);
365 ptbl = disk->part_tbl; 365 ptbl = disk->part_tbl;
366 366
367 if (ptbl->part[partno]) 367 if (ptbl->part[partno])
368 return -EBUSY; 368 return ERR_PTR(-EBUSY);
369 369
370 p = kzalloc(sizeof(*p), GFP_KERNEL); 370 p = kzalloc(sizeof(*p), GFP_KERNEL);
371 if (!p) 371 if (!p)
372 return -ENOMEM; 372 return ERR_PTR(-EBUSY);
373 373
374 if (!init_part_stats(p)) { 374 if (!init_part_stats(p)) {
375 err = -ENOMEM; 375 err = -ENOMEM;
@@ -424,20 +424,20 @@ int add_partition(struct gendisk *disk, int partno,
424 if (!ddev->uevent_suppress) 424 if (!ddev->uevent_suppress)
425 kobject_uevent(&pdev->kobj, KOBJ_ADD); 425 kobject_uevent(&pdev->kobj, KOBJ_ADD);
426 426
427 return 0; 427 return p;
428 428
429out_free_stats: 429out_free_stats:
430 free_part_stats(p); 430 free_part_stats(p);
431out_free: 431out_free:
432 kfree(p); 432 kfree(p);
433 return err; 433 return ERR_PTR(err);
434out_del: 434out_del:
435 kobject_put(p->holder_dir); 435 kobject_put(p->holder_dir);
436 device_del(pdev); 436 device_del(pdev);
437out_put: 437out_put:
438 put_device(pdev); 438 put_device(pdev);
439 blk_free_devt(devt); 439 blk_free_devt(devt);
440 return err; 440 return ERR_PTR(err);
441} 441}
442 442
443/* Not exported, helper to add_disk(). */ 443/* Not exported, helper to add_disk(). */
@@ -568,10 +568,11 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
568 disk->disk_name, p, (unsigned long long) size); 568 disk->disk_name, p, (unsigned long long) size);
569 size = get_capacity(disk) - from; 569 size = get_capacity(disk) - from;
570 } 570 }
571 res = add_partition(disk, p, from, size, state->parts[p].flags); 571 part = add_partition(disk, p, from, size,
572 if (res) { 572 state->parts[p].flags);
573 printk(KERN_ERR " %s: p%d could not be added: %d\n", 573 if (IS_ERR(part)) {
574 disk->disk_name, p, -res); 574 printk(KERN_ERR " %s: p%d could not be added: %ld\n",
575 disk->disk_name, p, -PTR_ERR(part));
575 continue; 576 continue;
576 } 577 }
577#ifdef CONFIG_BLK_DEV_MD 578#ifdef CONFIG_BLK_DEV_MD