From 6ae4e4b3028b277ab9bcf776bcbe4db8681af317 Mon Sep 17 00:00:00 2001 From: Salah Triki Date: Wed, 4 May 2016 04:42:46 +0100 Subject: [PATCH] staging: rtl8192u: propagate errors in write_nic_byte_E Propagate errors from kzalloc and usb_control_msg and change the return type of write_nic_byte_E from void to int. Signed-off-by: Salah Triki Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192u/r8192U.h | 2 +- drivers/staging/rtl8192u/r8192U_core.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index da9b92b86ab4..e0abcf571d8f 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -1130,7 +1130,7 @@ int read_nic_byte_E(struct net_device *dev, int x, u8 *data); int read_nic_dword(struct net_device *dev, int x, u32 *data); int read_nic_word(struct net_device *dev, int x, u16 *data); int write_nic_byte(struct net_device *dev, int x, u8 y); -void write_nic_byte_E(struct net_device *dev, int x, u8 y); +int write_nic_byte_E(struct net_device *dev, int x, u8 y); void write_nic_word(struct net_device *dev, int x, u16 y); void write_nic_dword(struct net_device *dev, int x, u32 y); void force_pci_posting(struct net_device *dev); diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 30c87c29e661..675e898d52ce 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -253,7 +253,7 @@ u32 read_cam(struct net_device *dev, u8 addr) return data; } -void write_nic_byte_E(struct net_device *dev, int indx, u8 data) +int write_nic_byte_E(struct net_device *dev, int indx, u8 data) { int status; struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); @@ -261,7 +261,7 @@ void write_nic_byte_E(struct net_device *dev, int indx, u8 data) u8 *usbdata = kzalloc(sizeof(data), GFP_KERNEL); if (!usbdata) - return; + return -ENOMEM; *usbdata = data; status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), @@ -269,9 +269,12 @@ void write_nic_byte_E(struct net_device *dev, int indx, u8 data) indx | 0xfe00, 0, usbdata, 1, HZ / 2); kfree(usbdata); - if (status < 0) + if (status < 0){ netdev_err(dev, "write_nic_byte_E TimeOut! status: %d\n", status); + return status; + } + return 0; } int read_nic_byte_E(struct net_device *dev, int indx, u8 *data) -- 2.39.5