Skip to content

Commit

Permalink
staging/crystalhd: assign PTR_ERR at fail cases to rc in chd_dec_init…
Browse files Browse the repository at this point in the history
…_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: Devendra Naga <develkernel412222@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Devendra Naga authored and Greg Kroah-Hartman committed Aug 14, 2012
1 parent cdf5e55 commit 3b2f1fb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/staging/crystalhd/crystalhd_lnx.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,15 @@ static int __devinit chd_dec_init_chdev(struct crystalhd_adp *adp)
/* register crystalhd class */
crystalhd_class = class_create(THIS_MODULE, "crystalhd");
if (IS_ERR(crystalhd_class)) {
rc = PTR_ERR(crystalhd_class);
BCMLOG_ERR("failed to create class\n");
goto fail;
}

dev = device_create(crystalhd_class, NULL, MKDEV(adp->chd_dec_major, 0),
NULL, "crystalhd");
if (IS_ERR(dev)) {
rc = PTR_ERR(crystalhd_class);
BCMLOG_ERR("failed to create device\n");
goto device_create_fail;
}
Expand Down

0 comments on commit 3b2f1fb

Please sign in to comment.