Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 31931
b: refs/heads/master
c: 454e895
h: refs/heads/master
i:
  31929: 03a3f55
  31927: 8bd51ac
v: v3
  • Loading branch information
Ishai Rabinovitz authored and James Bottomley committed Jul 1, 2006
1 parent 553e301 commit 7a14daa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0f13fc09db68de92585558984bff1c51b87db72f
refs/heads/master: 454e8957eb60841016deb319dbbf83042fb32a39
10 changes: 9 additions & 1 deletion trunk/drivers/scsi/sg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1402,6 +1402,7 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)
Sg_device *sdp = NULL;
struct cdev * cdev = NULL;
int error, k;
unsigned long iflags;

disk = alloc_disk(1);
if (!disk) {
Expand Down Expand Up @@ -1429,7 +1430,7 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)

error = cdev_add(cdev, MKDEV(SCSI_GENERIC_MAJOR, k), 1);
if (error)
goto out;
goto cdev_add_err;

sdp->cdev = cdev;
if (sg_sysfs_valid) {
Expand All @@ -1456,6 +1457,13 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf)

return 0;

cdev_add_err:
write_lock_irqsave(&sg_dev_arr_lock, iflags);
kfree(sg_dev_arr[k]);
sg_dev_arr[k] = NULL;
sg_nr_dev--;
write_unlock_irqrestore(&sg_dev_arr_lock, iflags);

out:
put_disk(disk);
if (cdev)
Expand Down

0 comments on commit 7a14daa

Please sign in to comment.