aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/st.c
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.de>2012-08-18 15:20:38 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-09-14 12:59:28 -0400
commite3f2a9cc84d35fac73c906de57ad3b3f5ff82008 (patch)
tree1815e0bc169e06a3f057aec22683940537811058 /drivers/scsi/st.c
parentaf23782beff27e720318fc44495287b9961a88e1 (diff)
[SCSI] st: clean up dev cleanup in st_probe
st_probe leaves a cdev pointer hanging around that is compared during the error path and freed later. There's no need for the pointer to hang around at all. So we free it immediately and simplify the error handling. Reviewed-by: Lee Duncan <lduncan@suse.com> Signed-off-by: Jeff Mahoney <jeffm@suse.com> Acked-by: Kai Mäkisara <kai.makisara@kolumbus.fi> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/st.c')
-rw-r--r--drivers/scsi/st.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 03303ae44434..492b53b6e51d 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4156,6 +4156,7 @@ static int st_probe(struct device *dev)
4156 printk(KERN_ERR 4156 printk(KERN_ERR
4157 "st%d: out of memory. Device not attached.\n", 4157 "st%d: out of memory. Device not attached.\n",
4158 dev_num); 4158 dev_num);
4159 cdev_del(cdev);
4159 goto out_free_tape; 4160 goto out_free_tape;
4160 } 4161 }
4161 cdev->owner = THIS_MODULE; 4162 cdev->owner = THIS_MODULE;
@@ -4194,17 +4195,13 @@ out_free_tape:
4194 "tape"); 4195 "tape");
4195 for (j=0; j < 2; j++) { 4196 for (j=0; j < 2; j++) {
4196 if (STm->cdevs[j]) { 4197 if (STm->cdevs[j]) {
4197 if (cdev == STm->cdevs[j]) 4198 device_destroy(&st_sysfs_class,
4198 cdev = NULL; 4199 MKDEV(SCSI_TAPE_MAJOR,
4199 device_destroy(&st_sysfs_class, 4200 TAPE_MINOR(i, mode, j)));
4200 MKDEV(SCSI_TAPE_MAJOR,
4201 TAPE_MINOR(i, mode, j)));
4202 cdev_del(STm->cdevs[j]); 4201 cdev_del(STm->cdevs[j]);
4203 } 4202 }
4204 } 4203 }
4205 } 4204 }
4206 if (cdev)
4207 cdev_del(cdev);
4208 write_lock(&st_dev_arr_lock); 4205 write_lock(&st_dev_arr_lock);
4209 scsi_tapes[dev_num] = NULL; 4206 scsi_tapes[dev_num] = NULL;
4210 st_nr_dev--; 4207 st_nr_dev--;