linux/drivers/staging
Nathan Chancellor 0bd3514664 staging: r8188eu: Reorganize error handling in rtw_drv_init()
After commit 987219ad34 ("staging: r8188eu: remove lines from Makefile
that silence build warnings"), clang warns:

drivers/staging/r8188eu/os_dep/usb_intf.c:726:6: warning: variable
'status' is used uninitialized whenever 'if' condition is true
[-Wsometimes-uninitialized]
        if (!if1) {
            ^~~~
drivers/staging/r8188eu/os_dep/usb_intf.c:741:6: note: uninitialized use
occurs here
        if (status != _SUCCESS)
            ^~~~~~
drivers/staging/r8188eu/os_dep/usb_intf.c:726:2: note: remove the 'if'
if its condition is always false
        if (!if1) {
        ^~~~~~~~~~~
drivers/staging/r8188eu/os_dep/usb_intf.c:714:12: note: initialize the
variable 'status' to silence this warning
        int status;
                  ^
                   = 0
1 warning generated.

status is not initialized if the call to usb_dvobj_init() or
rtw_usb_if1_init() fails.

Looking at the error function as a whole, the error handling is odd
compared to the rest of the kernel, which prefers to set error codes on
goto paths, rather than a global "status" variable which determines the
error code at the end of the function and function calls in the case of
error.

Rearrange the error handling of this function to bring it more inline
with how the kernel does it in most cases, which helps readability.

The call to rtw_usb_if1_deinit() is eliminated because it is not
possible to ever hit it; if rtw_usb_if1_init() fails, the goto call
jumps over the call to rtw_usb_if1_deinit() and in the success case,
status is set to _SUCCESS.

Acked-by: Phillip Potter <phil@philpotter.co.uk>
Acked-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20210812204027.338872-4-nathan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-13 08:37:19 +02:00
..
android staging: android: ashmem: add size field in procfs fdinfo 2021-06-18 13:02:40 +02:00
axis-fifo
board staging: board: Fix uninitialized spinlock when attaching genpd 2021-07-21 11:22:15 +02:00
clocking-wizard
emxx_udc staging: emxx_udc: fix alignment issues 2021-05-25 18:25:52 +02:00
fbtft staging/fbtft: Fix braces coding style 2021-08-05 13:05:57 +02:00
fieldbus
fwserial TTY / Serial patches for 5.14-rc1 2021-07-05 14:08:24 -07:00
gdm724x staging: gdm724x: Place macro argument within parentheses 2021-08-12 10:21:50 +02:00
greybus TTY / Serial patches for 5.14-rc1 2021-07-05 14:08:24 -07:00
gs_fpgaboot staging: fpgaboot: change FPGA indirect article to an 2021-06-09 14:26:54 +02:00
iio 1st set of new IIO/counter device support, features and cleanup for 5.14 2021-06-09 12:11:49 +02:00
ks7010 staging/ks7010: Remove all strcpy() uses in favor of strscpy() 2021-07-27 15:21:02 +02:00
media media: hantro: add support for Rockchip RK3036 2021-06-17 11:00:43 +02:00
most staging/most: Remove all strcpy() uses in favor of strscpy() 2021-07-27 15:10:41 +02:00
mt7621-dma
mt7621-dts Staging / IIO driver patches for 5.14-rc1 2021-07-05 14:01:53 -07:00
mt7621-pci staging: mt7621-pci: avoid to re-disable clock for those pcies not in use 2021-07-27 15:48:43 +02:00
netlogic
nvec
octeon
octeon-usb staging: octeon-hcd: Directly include linux/of.h 2021-06-10 13:09:15 +01:00
olpc_dcon kernel.h: split out panic and oops helpers 2021-07-01 11:06:04 -07:00
pi433
qlge staging: qlge: Remove unnecessary parentheses around references 2021-07-21 10:31:23 +02:00
r8188eu staging: r8188eu: Reorganize error handling in rtw_drv_init() 2021-08-13 08:37:19 +02:00
ralink-gdma staging: ralink-gdma: Remove incorrect author information 2021-06-09 12:07:52 +02:00
rtl8192e staging: rtl8192e: rtl_core: Fix possible null-pointer dereference in _rtl92e_pci_disconnect() 2021-08-11 09:43:44 +02:00
rtl8192u staging: rtl8192u: Avoid field-overflowing memcpy() 2021-08-10 12:09:35 +02:00
rtl8712 Merge 5.14-rc5 into staging-next 2021-08-09 08:59:23 +02:00
rtl8723bs staging: rtl8723bs: os_dep: remove unused variable 2021-08-10 12:15:14 +02:00
rts5208 staging: rts5208: remove redundant continue statement 2021-06-18 13:02:47 +02:00
sm750fb staging: sm750fb: Rename vScreen to v_screen in lynxfb_crtc 2021-07-28 20:17:26 +02:00
unisys staging: unisys: visorhba: Convert module from IDR to XArray 2021-06-15 13:55:11 +02:00
vc04_services staging: vchiq: Add details to Kconfig help texts 2021-08-10 12:08:46 +02:00
vme
vt6655 staging: vt665X: remove unused CONFIG_PATH 2021-07-30 10:20:53 +02:00
vt6656 staging: vt665X: remove unused CONFIG_PATH 2021-07-30 10:20:53 +02:00
wfx
wlan-ng staging/wlan-ng: Remove all strcpy() uses in favor of strscpy() 2021-07-27 15:11:10 +02:00
Kconfig staging: rtl8188eu: remove rtl8188eu driver from staging dir 2021-08-01 08:10:42 +02:00
Makefile staging: rtl8188eu: remove rtl8188eu driver from staging dir 2021-08-01 08:10:42 +02:00