Re: [PATCH v2] staging: r8188eu: convert rtw_pwr_wakeup to correct error code semantics

Phillip Potter
2022-07-26T22:14:38Z

On Tue, Jul 26, 2022 at 06:46:02PM +0300, Dan Carpenter wrote:
> On Tue, Jul 26, 2022 at 04:35:59PM +0300, Dan Carpenter wrote:
> > On Mon, Jul 25, 2022 at 11:07:45PM +0100, Phillip Potter wrote:
> > > Convert the rtw_pwr_wakeup function to use 0 on success and an appropriate
> > > error code on error. For the first failure block where ips_leave is
> > > invoked, use -ENOMEM as this is the main cause of failure here anyway.
> > > For the second failure block, use -EBUSY, as it seems the most
> > > appropriate.
> > >
> > > Finally, within the functions rtw_wx_set_mode, rtw_wx_set_wap,
> > > rtw_wx_set_scan and rtw_wx_set_essid, pass the error code on from
> > > rtw_pwr_wakeup as appropriate now that it is converted.
> > >
> > > This gets the driver closer to removal of the non-standard _SUCCESS and
> > > _FAIL definitions, which are inverted compared to the standard in-kernel
> > > error code mechanism.
> > >
> > > Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
> > > ---
> > >
> > > Changes from V1: Act on feedback from Dan Carpenter:
> > > * Try to use more appropriate error codes than -EPERM.
> > > * Revert the places where existing -1 was converted as they are out of
> > > scope.
> > > * Preserve error codes in places where calling function already uses
> > > proper negative semantics, so that they can be passed through to the
> > > caller.
> > >
> >
> > This is a much better patch, right? Everything hangs together better.
> >
> > There are seven callers which need to be updated and all of them are
> > updated.
> >
> > Reviewed-by: Dan Carpenter
>
> Oops. I messed up my R-b tag.
>
> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> regards,
> dan carpenter

Agreed, much cleaner this way. Thanks very much for the Reviewed-by tag
:-)

I'll attempt to structure the others in a similar fashion, as far as is
possible anyway.

All the best,
Phil