[bug report] staging: r8188eu: Fix smatch warnings in os_dep/*.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Larry and Martin,

The patch 0d5e4bfe47ea: "staging: r8188eu: Fix smatch warnings in
os_dep/*.c" from Aug 11, 2021, leads to the following
Smatch static checker warning:

	drivers/staging/r8188eu/os_dep/usb_intf.c:286 rtw_hw_resume()
	warn: variable dereferenced before check 'padapter' (see line 284)

drivers/staging/r8188eu/os_dep/usb_intf.c
    281 int rtw_hw_resume(struct adapter *padapter)
    282 {
    283         struct pwrctrl_priv *pwrpriv;
    284         struct net_device *pnetdev = padapter->pnetdev;
                                             ^^^^^^^^^^^^^^^^^
Dereferenced

    285 
--> 286         if (!padapter)
                    ^^^^^^^^^

Checked too late.

This warning was silenced when Smatch could tell that "padapter" was
non-NULL but Martin removed the last caller in commit c0a099b7341c
("staging: r8188eu: bHWPwrPindetect is always false").

So the correct fix is to just delete this function?

    287                 goto error_exit;
    288         pwrpriv = &padapter->pwrctrlpriv;
    289         DBG_88E("==> rtw_hw_resume\n");
    290         _enter_pwrlock(&pwrpriv->lock);
    291         pwrpriv->bips_processing = true;
    292         rtw_reset_drv_sw(padapter);
    293 

regards,
dan carpenter




[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux