usbnet/smsc75xx: silence uninitialized variable warning
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 4 May 2016 06:21:02 +0000 (09:21 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 May 2016 20:58:56 +0000 (16:58 -0400)
If the fn() calls fail then "buf" is uninitialized.  Just return early
in that situation.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/smsc75xx.c

index c369db99c005bd69e73217a60bfa87458ebeec9b..9af9799935dbbd4baed06eb03402803e0ce8d9c8 100644 (file)
@@ -99,9 +99,11 @@ static int __must_check __smsc75xx_read_reg(struct usbnet *dev, u32 index,
        ret = fn(dev, USB_VENDOR_REQUEST_READ_REGISTER, USB_DIR_IN
                 | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
                 0, index, &buf, 4);
-       if (unlikely(ret < 0))
+       if (unlikely(ret < 0)) {
                netdev_warn(dev->net, "Failed to read reg index 0x%08x: %d\n",
                            index, ret);
+               return ret;
+       }
 
        le32_to_cpus(&buf);
        *data = buf;