[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220727124342.GR2316@kadam>
Date: Wed, 27 Jul 2022 15:43:42 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: Phillip Potter <phil@...lpotter.co.uk>, Larry.Finger@...inger.net,
paskripkin@...il.com, straube.linux@...il.com, martin@...ser.cx,
abdun.nihaal@...il.com, philipp.g.hortmann@...il.com,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] staging: r8188eu: convert rtw_pwr_wakeup to correct
error code semantics
On Wed, Jul 27, 2022 at 08:33:14AM +0200, Greg KH wrote:
> > diff --git a/drivers/staging/r8188eu/core/rtw_pwrctrl.c b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
> > index cf9020a73933..8b1c50668dfe 100644
> > --- a/drivers/staging/r8188eu/core/rtw_pwrctrl.c
> > +++ b/drivers/staging/r8188eu/core/rtw_pwrctrl.c
> > @@ -381,24 +381,24 @@ int rtw_pwr_wakeup(struct adapter *padapter)
> > struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
> > unsigned long timeout = jiffies + msecs_to_jiffies(3000);
> > unsigned long deny_time;
> > - int ret = _SUCCESS;
> > + int ret = 0;
> >
> > while (pwrpriv->ps_processing && time_before(jiffies, timeout))
> > msleep(10);
> >
> > /* I think this should be check in IPS, LPS, autosuspend functions... */
> > if (check_fwstate(pmlmepriv, _FW_LINKED)) {
> > - ret = _SUCCESS;
> > + ret = 0;
>
> Nit, you don't need to set this again, as you already set it above to 0.
>
I would sort of prefer to drop the initialization and keep this one.
Otherwise it causes a Smatch warning about missing error codes. It
*looks* buggy too, like it should be an error path. Sometimes people
add a comment explaining why those are success paths and not error paths
which also works.
The Smatch check will no warn if there is a "ret = 0;" within 4(?) lines
of the goto because that's probably intentional.
regards,
dan carpenter
Powered by blists - more mailing lists