[PATCH V3] staging: rtl8192u: check return value of read_nic_word_E

Sudip Mukherjee sudipm.mukherjee at gmail.com
Mon Mar 7 07:52:24 UTC 2016


On Fri, Mar 04, 2016 at 11:40:29AM +0100, Salah Triki wrote:
> The call of read_nic_word_E may fail, therefore its return value must be
> checked.
> 
> Signed-off-by: Salah Triki <salah.triki at acm.org>
> ---
>  drivers/staging/rtl8192u/r8180_93cx6.c |  30 +++++--
>  drivers/staging/rtl8192u/r8180_93cx6.h |   2 +-
>  drivers/staging/rtl8192u/r8192U_core.c | 140 ++++++++++++++++++++++-----------
>  3 files changed, 119 insertions(+), 53 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/r8180_93cx6.c b/drivers/staging/rtl8192u/r8180_93cx6.c
<snip>
> @@ -144,7 +157,10 @@ u32 eprom_read(struct net_device *dev, u32 addr)
>  		 * and reading data. (eeprom outs a dummy 0)
>  		 */
>  		eprom_ck_cycle(dev);
> -		ret |= (eprom_r(dev)<<(15-i));
> +		err = eprom_r(dev)<<(15-i);

read_nic_byte_E() can return -ENOMEM so eprom_r() also can return
-ENOMEM. So if eprom_r() fails then err becomes -12 << (15-i) where i
ranges from 0 to 16.

> +		if (err)
> +			return err;

And that values is used to decide the error. oops... am i reading it
properly?

regards
sudip


More information about the devel mailing list