Re: [PATCH v3 3/6] staging: r8188eu: add error handling of rtw_read8

From: Pavel Skripkin
Date: Thu Aug 26 2021 - 01:13:39 EST


On 8/26/21 2:45 AM, Fabio M. De Francesco wrote:
On Tuesday, August 24, 2021 9:27:27 AM CEST Pavel Skripkin wrote:
_rtw_read8 function can fail in case of usb transfer failure. But
previous function prototype wasn't designed to return an error to
caller. It can cause a lot uninit value bugs all across the driver code,
since rtw_read8() returns local stack variable to caller.

Fix it by changing the prototype of this function. Now it returns an
int: 0 on success, negative error value on failure and callers should pass
the pointer to storage location for register value.

Signed-off-by: Pavel Skripkin <paskripkin@xxxxxxxxx>

Dear Pavel,

I have to inform you that building patch v3 3/6 with gcc (version 11.1.1 20210721
[revision 076930b9690ac3564638636f6b13bbb6bc608aea] (SUSE Linux)), gives
the following warning:

drivers/staging/r8188eu/os_dep/ioctl_linux.c:2258:13: warning: variable ‘error’ set but not used [-Wunused-but-set-variable]
2258 | int error;
| ^~~~~

I'm sorry, but I guess that for some reason previously I had only built v2 of your patch
which had no warnings at all.

Unfortunately, introducing warnings is not allowed.

While we are at this, I can also confirm that GCC 11.1.1 _does_ _not_ emit the warning
that has been reported by the kernel test robot.


Yep, I see, thank you. v4 is on the way... I had a plan to send v4 yesterday, but I've finally received r8188eu device.

I tried to connect it and test and.... driver didn't work :) So, I will try to figure out the problem with driver (or device) and will send v4.

Again, thank you for report :) My default gcc is too polite...




With regards,
Pavel Skripkin