[PATCH 10/10] staging: rtl8188eu: return an error code, not a boolean

Larry Finger Larry.Finger at lwfinger.net
Thu May 14 15:38:59 UTC 2015


On 05/13/2015 05:08 PM, Luca Ceresoli wrote:
> Several functions in this driver return a boolean: _SUCCESS = 1 on success,
> _FAIL = 0 on error, defined in
> drivers/staging/rtl8188eu/include/osdep_service.h.
>
> The common practice in the Linux kernel is to return 0 on success, a negative
> error code otherwise. This has the advantage that the return value also
> describes the kind of error that happened, while a boolean squashes all errors
> down a unique value.
>
> Change rtw_start_drv_threads() to return a proper 0-or-error value.
>
> Signed-off-by: Luca Ceresoli <luca at lucaceresoli.net>
> Cc: Greg Kroah-Hartman <gregkh at linux.com>
> Cc: Larry Finger <Larry.Finger at lwfinger.net>
>
> ---
>
> I think _SUCCESS and _FAIL should be totally eradicated and replaced with
> proper error codes and my intent is to do it all over the codebase.
> However, since that would be a massive change, I'm sending this small
> patch to get some feedback. Should the idea be accepted, I'd go on.

I have no objections to the major change from those macros to simple 1 and 0. 
Such changes would be more acceptable if you have the hardware and can test as 
well to eliminate any subtle side effects..

Larry



More information about the devel mailing list