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

Dan Carpenter
2022-07-26T13:36:49Z

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