staging: ks7010: return directly on error
authorTobin C. Harding <me@tobin.cc>
Tue, 21 Mar 2017 02:37:08 +0000 (13:37 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Mar 2017 07:56:07 +0000 (08:56 +0100)
Function uses goto label with no clean up code. In this case we
should just return directly.

Remove goto statement, return directly on error.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ks7010/ks7010_sdio.c
drivers/staging/ks7010/ks_wlan_net.c

index 1d3a15f..3dab700 100644 (file)
@@ -400,7 +400,7 @@ static void ks_wlan_hw_rx(void *dev, uint16_t size)
        if (cnt_rxqbody(priv) >= (RX_DEVICE_BUFF_SIZE - 1)) {
                /* in case of buffer overflow */
                DPRINTK(1, "rx buffer overflow\n");
-               goto error_out;
+               return;
        }
        rx_buffer = &priv->rx_dev.rx_dev_buff[priv->rx_dev.qtail];
 
@@ -408,7 +408,7 @@ static void ks_wlan_hw_rx(void *dev, uint16_t size)
            ks7010_sdio_read(priv, DATA_WINDOW, &rx_buffer->data[0],
                             hif_align_size(size));
        if (retval)
-               goto error_out;
+               return;
 
        /* length check */
        if (size > 2046 || size == 0) {
@@ -426,7 +426,8 @@ static void ks_wlan_hw_rx(void *dev, uint16_t size)
                if (retval)
                        DPRINTK(1, " error : READ_STATUS=%02X\n", read_status);
 
-               goto error_out;
+               /* length check fail */
+               return;
        }
 
        hdr = (struct hostif_hdr *)&rx_buffer->data[0];
@@ -453,9 +454,6 @@ static void ks_wlan_hw_rx(void *dev, uint16_t size)
 
        /* rx_event_task((void *)priv); */
        tasklet_schedule(&priv->ks_wlan_hw.rx_bh_task);
-
- error_out:
-       return;
 }
 
 static void ks7010_rw_function(struct work_struct *work)
index f18ff56..d96eed6 100644 (file)
@@ -202,7 +202,6 @@ static int ks_wlan_set_freq(struct net_device *dev,
 {
        struct ks_wlan_private *priv =
            (struct ks_wlan_private *)netdev_priv(dev);
-       int rc = -EINPROGRESS;  /* Call commit handler */
 
        if (priv->sleep_mode == SLP_SLEEP)
                return -EPERM;
@@ -222,7 +221,7 @@ static int ks_wlan_set_freq(struct net_device *dev,
        }
        /* Setting by channel number */
        if ((fwrq->m > 1000) || (fwrq->e > 0)) {
-               rc = -EOPNOTSUPP;
+               return -EOPNOTSUPP;
        } else {
                int channel = fwrq->m;
                /* We should do a better check than that,
@@ -232,7 +231,7 @@ static int ks_wlan_set_freq(struct net_device *dev,
                        netdev_dbg(dev,
                                   "%s: New channel value of %d is invalid!\n",
                                   dev->name, fwrq->m);
-                       rc = -EINVAL;
+                       return -EINVAL;
                } else {
                        /* Yes ! We can set it !!! */
                        priv->reg.channel = (u8)(channel);
@@ -240,7 +239,7 @@ static int ks_wlan_set_freq(struct net_device *dev,
                }
        }
 
-       return rc;
+       return -EINPROGRESS;    /* Call commit handler */
 }
 
 static int ks_wlan_get_freq(struct net_device *dev,