提交 675fe097 编写于 作者: D Devendra Naga 提交者: Greg Kroah-Hartman

staging/crystalhd: unregister chardev when class_create fails in chd_dec_init_chdev

we missed a unregiser_chrdev if the class_create and subsequent function calls / checks fail
Signed-off-by: NDevendra Naga <develkernel412222@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 3b2f1fbe
......@@ -375,7 +375,7 @@ static int __devinit chd_dec_init_chdev(struct crystalhd_adp *adp)
if (IS_ERR(crystalhd_class)) {
rc = PTR_ERR(crystalhd_class);
BCMLOG_ERR("failed to create class\n");
goto fail;
goto class_create_fail;
}
dev = device_create(crystalhd_class, NULL, MKDEV(adp->chd_dec_major, 0),
......@@ -412,6 +412,8 @@ static int __devinit chd_dec_init_chdev(struct crystalhd_adp *adp)
device_destroy(crystalhd_class, MKDEV(adp->chd_dec_major, 0));
device_create_fail:
class_destroy(crystalhd_class);
class_create_fail:
unregister_chrdev(adp->chd_dec_major, CRYSTALHD_API_NAME);
fail:
return rc;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册