mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 06:47:41 +07:00
staging: rtl8192u: propagate errors in write_nic_byte
Propagate errors from kzalloc and usb_control_msg and change the return type of write_nic_byte from void to int. Signed-off-by: Salah Triki <salah.triki@acm.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
4dc2abb852
commit
ba15f657ce
@ -1129,7 +1129,7 @@ int read_nic_byte(struct net_device *dev, int x, u8 *data);
|
|||||||
int read_nic_byte_E(struct net_device *dev, int x, u8 *data);
|
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_dword(struct net_device *dev, int x, u32 *data);
|
||||||
int read_nic_word(struct net_device *dev, int x, u16 *data);
|
int read_nic_word(struct net_device *dev, int x, u16 *data);
|
||||||
void write_nic_byte(struct net_device *dev, int x, u8 y);
|
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);
|
void 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_word(struct net_device *dev, int x, u16 y);
|
||||||
void write_nic_dword(struct net_device *dev, int x, u32 y);
|
void write_nic_dword(struct net_device *dev, int x, u32 y);
|
||||||
|
@ -299,7 +299,7 @@ int read_nic_byte_E(struct net_device *dev, int indx, u8 *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* as 92U has extend page from 4 to 16, so modify functions below. */
|
/* as 92U has extend page from 4 to 16, so modify functions below. */
|
||||||
void write_nic_byte(struct net_device *dev, int indx, u8 data)
|
int write_nic_byte(struct net_device *dev, int indx, u8 data)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ void write_nic_byte(struct net_device *dev, int indx, u8 data)
|
|||||||
u8 *usbdata = kzalloc(sizeof(data), GFP_KERNEL);
|
u8 *usbdata = kzalloc(sizeof(data), GFP_KERNEL);
|
||||||
|
|
||||||
if (!usbdata)
|
if (!usbdata)
|
||||||
return;
|
return -ENOMEM;
|
||||||
*usbdata = data;
|
*usbdata = data;
|
||||||
|
|
||||||
status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
|
status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
|
||||||
@ -317,8 +317,12 @@ void write_nic_byte(struct net_device *dev, int indx, u8 data)
|
|||||||
usbdata, 1, HZ / 2);
|
usbdata, 1, HZ / 2);
|
||||||
kfree(usbdata);
|
kfree(usbdata);
|
||||||
|
|
||||||
if (status < 0)
|
if (status < 0) {
|
||||||
netdev_err(dev, "write_nic_byte TimeOut! status: %d\n", status);
|
netdev_err(dev, "write_nic_byte TimeOut! status: %d\n", status);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user