Re: [PATCH 2/2] staging: rtl8723bs: cleanup return in sdio_init()

From: Dan Carpenter

Date: Thu Mar 26 2026 - 03:20:10 EST


On Wed, Mar 25, 2026 at 07:51:27PM +0100, Omer wrote:
> I will make a v2 patch for this series.
> My question is do I go back to returning error pointers for
> sdio_dvobj_init? I did that in my original commit so that
> the proper errno would be propagated back to the rtw_drv_init probe
> function in sdio_intf.c.

No, just keep it as return NULL. But the check should be:

ret = sdio_init(dvobj);
if (ret) {

Because that's the standard way to do error handling. It's slightly
more readable than the alternatives like:

if (sdio_init(dvobj) < 0) {

> sdio_dvobj_init function can fail due to both allocation issues and
> sdio_init failure. So i thought it would be more
> descriptive to propagate an error pointer instead of NULL for both cases.

It's more descriptive but returning NULL is fine. Every change
you make adds places where people can disagree with you. We
want to change from _SUCCESS/_FAIL to standard error codes. Fine
everyone agrees with that. But then changing to error pointers?
Some people might agree and some might not. And then it's like,
okay we have 99 functions which return NULL and 1 function which
returns error pointers. And we get into a whole discussion about
it. Forget it. Just return NULL.

regards,
dan carpenter