ser_gigaset: return -ENOMEM on error instead of success
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 7 Dec 2016 11:22:03 +0000 (14:22 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 8 Dec 2016 19:19:17 +0000 (14:19 -0500)
If we can't allocate the resources in gigaset_initdriver() then we
should return -ENOMEM instead of zero.

Fixes: 2869b23e4b95 ("[PATCH] drivers/isdn/gigaset: new M101 driver (v2)")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/isdn/gigaset/ser-gigaset.c

index d1f8ab915b15cc69b5fc9564777d413dad0f8318..b90776ef56ec8d2d35e8b51a79f75c2ecd472ab1 100644 (file)
@@ -755,8 +755,10 @@ static int __init ser_gigaset_init(void)
        driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS,
                                    GIGASET_MODULENAME, GIGASET_DEVNAME,
                                    &ops, THIS_MODULE);
-       if (!driver)
+       if (!driver) {
+               rc = -ENOMEM;
                goto error;
+       }
 
        rc = tty_register_ldisc(N_GIGASET_M101, &gigaset_ldisc);
        if (rc != 0) {