Skip to content

Commit

Permalink
bsg: add cheasy error checks for sysfs stuff
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Jens Axboe committed Jul 16, 2007
1 parent 5309cb3 commit 264a047
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion block/bsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -983,10 +983,19 @@ int bsg_register_disk(struct gendisk *disk)
bsg_device_nr++;
bcd->disk = disk;
bcd->class_dev = class_device_create(bsg_class, NULL, dev, bcd->dev, "%s", disk->disk_name);
if (!bcd->class_dev)
goto err;
list_add_tail(&bcd->list, &bsg_class_list);
sysfs_create_link(&q->kobj, &bcd->class_dev->kobj, "bsg");
if (sysfs_create_link(&q->kobj, &bcd->class_dev->kobj, "bsg"))
goto err;
mutex_unlock(&bsg_mutex);
return 0;
err:
bsg_device_nr--;
if (bcd->class_dev)
class_device_destroy(bsg_class, MKDEV(BSG_MAJOR, bcd->minor));
mutex_unlock(&bsg_mutex);
return -ENOMEM;
}

static int __init bsg_init(void)
Expand Down

0 comments on commit 264a047

Please sign in to comment.