Merge branch 'drm-tda998x-fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm into...
[firefly-linux-kernel-4.4.55.git] / drivers / isdn / gigaset / ser-gigaset.c
index 6f3fd4cf437881d254e793fee7050ebf2597c7fd..8c91fd5eb6fdd4696f8b6d298eef8684525fc94e 100644 (file)
@@ -340,17 +340,16 @@ static int gigaset_initbcshw(struct bc_state *bcs)
 {
        /* unused */
        bcs->hw.ser = NULL;
-       return 1;
+       return 0;
 }
 
 /*
  * Free B channel structure
  * Called by "gigaset_freebcs" in common.c
  */
-static int gigaset_freebcshw(struct bc_state *bcs)
+static void gigaset_freebcshw(struct bc_state *bcs)
 {
        /* unused */
-       return 1;
 }
 
 /*
@@ -398,7 +397,7 @@ static int gigaset_initcshw(struct cardstate *cs)
        scs = kzalloc(sizeof(struct ser_cardstate), GFP_KERNEL);
        if (!scs) {
                pr_err("out of memory\n");
-               return 0;
+               return -ENOMEM;
        }
        cs->hw.ser = scs;
 
@@ -410,13 +409,13 @@ static int gigaset_initcshw(struct cardstate *cs)
                pr_err("error %d registering platform device\n", rc);
                kfree(cs->hw.ser);
                cs->hw.ser = NULL;
-               return 0;
+               return rc;
        }
        dev_set_drvdata(&cs->hw.ser->dev.dev, cs);
 
        tasklet_init(&cs->write_tasklet,
                     gigaset_modem_fill, (unsigned long) cs);
-       return 1;
+       return 0;
 }
 
 /*
@@ -503,6 +502,7 @@ static int
 gigaset_tty_open(struct tty_struct *tty)
 {
        struct cardstate *cs;
+       int rc;
 
        gig_dbg(DEBUG_INIT, "Starting HLL for Gigaset M101");
 
@@ -515,8 +515,10 @@ gigaset_tty_open(struct tty_struct *tty)
 
        /* allocate memory for our device state and initialize it */
        cs = gigaset_initcs(driver, 1, 1, 0, cidmode, GIGASET_MODULENAME);
-       if (!cs)
+       if (!cs) {
+               rc = -ENODEV;
                goto error;
+       }
 
        cs->dev = &cs->hw.ser->dev.dev;
        cs->hw.ser->tty = tty;
@@ -530,7 +532,8 @@ gigaset_tty_open(struct tty_struct *tty)
         */
        if (startmode == SM_LOCKED)
                cs->mstate = MS_LOCKED;
-       if (!gigaset_start(cs)) {
+       rc = gigaset_start(cs);
+       if (rc < 0) {
                tasklet_kill(&cs->write_tasklet);
                goto error;
        }
@@ -542,7 +545,7 @@ error:
        gig_dbg(DEBUG_INIT, "Startup of HLL failed");
        tty->disc_data = NULL;
        gigaset_freecs(cs);
-       return -ENODEV;
+       return rc;
 }
 
 /*