提交 e3f2a9cc 编写于 作者: J Jeff Mahoney 提交者: James Bottomley

[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: NLee Duncan <lduncan@suse.com>
Signed-off-by: NJeff Mahoney <jeffm@suse.com>
Acked-by: NKai Mäkisara <kai.makisara@kolumbus.fi>
Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
上级 af23782b
无相关合并请求
...@@ -4156,6 +4156,7 @@ static int st_probe(struct device *dev) ...@@ -4156,6 +4156,7 @@ static int st_probe(struct device *dev)
printk(KERN_ERR printk(KERN_ERR
"st%d: out of memory. Device not attached.\n", "st%d: out of memory. Device not attached.\n",
dev_num); dev_num);
cdev_del(cdev);
goto out_free_tape; goto out_free_tape;
} }
cdev->owner = THIS_MODULE; cdev->owner = THIS_MODULE;
...@@ -4194,17 +4195,13 @@ static int st_probe(struct device *dev) ...@@ -4194,17 +4195,13 @@ static int st_probe(struct device *dev)
"tape"); "tape");
for (j=0; j < 2; j++) { for (j=0; j < 2; j++) {
if (STm->cdevs[j]) { if (STm->cdevs[j]) {
if (cdev == STm->cdevs[j]) device_destroy(&st_sysfs_class,
cdev = NULL; MKDEV(SCSI_TAPE_MAJOR,
device_destroy(&st_sysfs_class, TAPE_MINOR(i, mode, j)));
MKDEV(SCSI_TAPE_MAJOR,
TAPE_MINOR(i, mode, j)));
cdev_del(STm->cdevs[j]); cdev_del(STm->cdevs[j]);
} }
} }
} }
if (cdev)
cdev_del(cdev);
write_lock(&st_dev_arr_lock); write_lock(&st_dev_arr_lock);
scsi_tapes[dev_num] = NULL; scsi_tapes[dev_num] = NULL;
st_nr_dev--; st_nr_dev--;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部