aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/bsg.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/block/bsg.c b/block/bsg.c
index c56618ae54c3..e97e3ec08ffc 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -983,10 +983,19 @@ int bsg_register_disk(struct gendisk *disk)
983 bsg_device_nr++; 983 bsg_device_nr++;
984 bcd->disk = disk; 984 bcd->disk = disk;
985 bcd->class_dev = class_device_create(bsg_class, NULL, dev, bcd->dev, "%s", disk->disk_name); 985 bcd->class_dev = class_device_create(bsg_class, NULL, dev, bcd->dev, "%s", disk->disk_name);
986 if (!bcd->class_dev)
987 goto err;
986 list_add_tail(&bcd->list, &bsg_class_list); 988 list_add_tail(&bcd->list, &bsg_class_list);
987 sysfs_create_link(&q->kobj, &bcd->class_dev->kobj, "bsg"); 989 if (sysfs_create_link(&q->kobj, &bcd->class_dev->kobj, "bsg"))
990 goto err;
988 mutex_unlock(&bsg_mutex); 991 mutex_unlock(&bsg_mutex);
989 return 0; 992 return 0;
993err:
994 bsg_device_nr--;
995 if (bcd->class_dev)
996 class_device_destroy(bsg_class, MKDEV(BSG_MAJOR, bcd->minor));
997 mutex_unlock(&bsg_mutex);
998 return -ENOMEM;
990} 999}
991 1000
992static int __init bsg_init(void) 1001static int __init bsg_init(void)