public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Larry.Finger@lwfinger.net, Martin Kaiser <martin@kaiser.cx>
Cc: linux-staging@lists.linux.dev
Subject: [bug report] staging: r8188eu: Fix smatch warnings in os_dep/*.c
Date: Fri, 17 Sep 2021 16:15:15 +0300	[thread overview]
Message-ID: <20210917131515.GA31208@kili> (raw)


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

             reply	other threads:[~2021-09-17 13:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17 13:15 Dan Carpenter [this message]
2021-09-17 18:26 ` [bug report] staging: r8188eu: Fix smatch warnings in os_dep/*.c Martin Kaiser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210917131515.GA31208@kili \
    --to=dan.carpenter@oracle.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=linux-staging@lists.linux.dev \
    --cc=martin@kaiser.cx \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox