]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging/crystalhd: assign PTR_ERR at fail cases to rc in chd_dec_init_chdev
authorDevendra Naga <develkernel412222@gmail.com>
Sun, 5 Aug 2012 21:13:47 +0000 (02:58 +0545)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Aug 2012 02:15:49 +0000 (19:15 -0700)
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>
drivers/staging/crystalhd/crystalhd_lnx.c

index d9e3d618f7f4de52bfb3928cf4d42b12aa68da73..0582ac04b75c929ba5aa89c441edc65e8b4cddef 100644 (file)
@@ -373,6 +373,7 @@ 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;
        }
@@ -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),
                            NULL, "crystalhd");
        if (IS_ERR(dev)) {
+               rc = PTR_ERR(crystalhd_class);
                BCMLOG_ERR("failed to create device\n");
                goto device_create_fail;
        }