From: Dan Carpenter Date: Wed, 4 May 2016 06:22:01 +0000 (+0300) Subject: usbnet: smsc95xx: silence an uninitialized variable warning X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5a36b68b670ebdf19eaedd4f859810293a3d1dc1;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git usbnet: smsc95xx: silence an uninitialized variable warning If the call to fn() fails then "buf" is uninitialized. Just return the error code in that case. Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller --- diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 2edc2bc6d1b9..d9d2806a47b1 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -92,9 +92,11 @@ static int __must_check __smsc95xx_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;