Commit 3b2f1fbe authored by Devendra Naga's avatar Devendra Naga Committed by Greg Kroah-Hartman

staging/crystalhd: assign PTR_ERR at fail cases to rc in chd_dec_init_chdev

the rc assignment to PTR_ERR at fail cases of class_create and device_create are missed out,
return proper error rather than returning -ENODEV.
Signed-off-by: default avatarDevendra Naga <develkernel412222@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cdf5e551
...@@ -373,6 +373,7 @@ static int __devinit chd_dec_init_chdev(struct crystalhd_adp *adp) ...@@ -373,6 +373,7 @@ static int __devinit chd_dec_init_chdev(struct crystalhd_adp *adp)
/* register crystalhd class */ /* register crystalhd class */
crystalhd_class = class_create(THIS_MODULE, "crystalhd"); crystalhd_class = class_create(THIS_MODULE, "crystalhd");
if (IS_ERR(crystalhd_class)) { if (IS_ERR(crystalhd_class)) {
rc = PTR_ERR(crystalhd_class);
BCMLOG_ERR("failed to create class\n"); BCMLOG_ERR("failed to create class\n");
goto fail; goto fail;
} }
...@@ -380,6 +381,7 @@ static int __devinit chd_dec_init_chdev(struct crystalhd_adp *adp) ...@@ -380,6 +381,7 @@ static int __devinit chd_dec_init_chdev(struct crystalhd_adp *adp)
dev = device_create(crystalhd_class, NULL, MKDEV(adp->chd_dec_major, 0), dev = device_create(crystalhd_class, NULL, MKDEV(adp->chd_dec_major, 0),
NULL, "crystalhd"); NULL, "crystalhd");
if (IS_ERR(dev)) { if (IS_ERR(dev)) {
rc = PTR_ERR(crystalhd_class);
BCMLOG_ERR("failed to create device\n"); BCMLOG_ERR("failed to create device\n");
goto device_create_fail; goto device_create_fail;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment