Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3f2a9cc authored by Jeff Mahoney's avatar Jeff Mahoney Committed by James Bottomley
Browse files

[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: default avatarLee Duncan <lduncan@suse.com>
Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
Acked-by: default avatarKai Mäkisara <kai.makisara@kolumbus.fi>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent af23782b
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -4156,6 +4156,7 @@ static int st_probe(struct device *dev)
				printk(KERN_ERR
				       "st%d: out of memory. Device not attached.\n",
				       dev_num);
				cdev_del(cdev);
				goto out_free_tape;
			}
			cdev->owner = THIS_MODULE;
@@ -4194,8 +4195,6 @@ static int st_probe(struct device *dev)
				  "tape");
		for (j=0; j < 2; j++) {
			if (STm->cdevs[j]) {
				if (cdev == STm->cdevs[j])
					cdev = NULL;
				device_destroy(&st_sysfs_class,
					       MKDEV(SCSI_TAPE_MAJOR,
						     TAPE_MINOR(i, mode, j)));
@@ -4203,8 +4202,6 @@ static int st_probe(struct device *dev)
			}
		}
	}
	if (cdev)
		cdev_del(cdev);
	write_lock(&st_dev_arr_lock);
	scsi_tapes[dev_num] = NULL;
	st_nr_dev--;