提交 6826ee4f 编写于 作者: J James Bottomley 提交者: James Bottomley

[SCSI] bsg: fix bsg_register_queue error path

unfortunately, if IS_ERR(class_dev) is true, that means class_dev isn't
null and the check in the error leg is pointless ... it's also asking
for trouble to request unregistration of a device we haven't actually
created (although it works currently).  Fix by using explicit gotos and
unregisters.
Acked-by: NFUJITA Tomonori <tomof@acm.org>
Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
上级 d73f5222
......@@ -993,7 +993,7 @@ int bsg_register_queue(struct request_queue *q, const char *name)
if (q->kobj.sd) {
ret = sysfs_create_link(&q->kobj, &bcd->class_dev->kobj, "bsg");
if (ret)
goto err;
goto err_unregister;
}
list_add_tail(&bcd->list, &bsg_class_list);
......@@ -1001,9 +1001,10 @@ int bsg_register_queue(struct request_queue *q, const char *name)
mutex_unlock(&bsg_mutex);
return 0;
err_unregister:
class_device_unregister(class_dev);
err:
if (class_dev)
class_device_destroy(bsg_class, MKDEV(bsg_major, bcd->minor));
mutex_unlock(&bsg_mutex);
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册