aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sg.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-07-05 08:27:42 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-07-05 08:27:42 -0400
commitcf57a308436653f3094590202c77459aab250ff3 (patch)
tree8a9e7096e494141911147a1f24865c3d79d583c1 /drivers/scsi/sg.c
parentfaac9bd0e3ce7cb0572ec66e0a426cacf6afa970 (diff)
parentca78f6baca863afe2e6a244a0fe94b3a70211d46 (diff)
Merge branch 'master'
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r--drivers/scsi/sg.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 4e607d3065bc..65eef33846bb 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1401,6 +1401,7 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
1401 Sg_device *sdp = NULL; 1401 Sg_device *sdp = NULL;
1402 struct cdev * cdev = NULL; 1402 struct cdev * cdev = NULL;
1403 int error, k; 1403 int error, k;
1404 unsigned long iflags;
1404 1405
1405 disk = alloc_disk(1); 1406 disk = alloc_disk(1);
1406 if (!disk) { 1407 if (!disk) {
@@ -1428,7 +1429,7 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
1428 1429
1429 error = cdev_add(cdev, MKDEV(SCSI_GENERIC_MAJOR, k), 1); 1430 error = cdev_add(cdev, MKDEV(SCSI_GENERIC_MAJOR, k), 1);
1430 if (error) 1431 if (error)
1431 goto out; 1432 goto cdev_add_err;
1432 1433
1433 sdp->cdev = cdev; 1434 sdp->cdev = cdev;
1434 if (sg_sysfs_valid) { 1435 if (sg_sysfs_valid) {
@@ -1455,6 +1456,13 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
1455 1456
1456 return 0; 1457 return 0;
1457 1458
1459cdev_add_err:
1460 write_lock_irqsave(&sg_dev_arr_lock, iflags);
1461 kfree(sg_dev_arr[k]);
1462 sg_dev_arr[k] = NULL;
1463 sg_nr_dev--;
1464 write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
1465
1458out: 1466out:
1459 put_disk(disk); 1467 put_disk(disk);
1460 if (cdev) 1468 if (cdev)