public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Omer <omer.e.idrissi@gmail.com>
Cc: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] staging: rtl8723bs: cleanup return in sdio_init()
Date: Thu, 26 Mar 2026 10:19:58 +0300	[thread overview]
Message-ID: <acTeHqD9QZnM4Ob2@stanley.mountain> (raw)
In-Reply-To: <CACx49NdDxFcsJayDz8ERbn04yq7g+JqvPAEf_-xojSH68uMJ5Q@mail.gmail.com>

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


  reply	other threads:[~2026-03-26  7:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24 22:04 [PATCH 0/2] rtl8723bs: clean up error handling Omer El Idrissi
2026-03-24 22:04 ` [PATCH 1/2] staging: rtl8723bs: use direct returns in sdio_dvobj_init() Omer El Idrissi
2026-03-24 22:04 ` [PATCH 2/2] staging: rtl8723bs: cleanup return in sdio_init() Omer El Idrissi
2026-03-25  7:36   ` Dan Carpenter
2026-03-25 18:51     ` Omer
2026-03-26  7:19       ` Dan Carpenter [this message]
2026-03-25 19:05 ` [PATCH v2 0/3] clean up error handling Omer El Idrissi
2026-03-25 19:05   ` [PATCH v2 1/3] staging: rtl8723bs: use direct returns in sdio_dvobj_init() Omer El Idrissi
2026-03-25 19:05   ` [PATCH v2 2/3] staging: rtl8723bs: cleanup return in sdio_init() Omer El Idrissi
2026-03-25 19:06   ` [PATCH v2 3/3] staging: rtl8723bs: clean up callees for sdio_init function Omer El Idrissi
2026-03-26  8:16 ` [PATCH v3 0/4] clean up error handling Omer El Idrissi
2026-03-26  8:16   ` [PATCH v3 1/4] staging: rtl8723bs: use direct returns in sdio_dvobj_init() Omer El Idrissi
2026-03-26  8:16   ` [PATCH v3 2/4] staging: rtl8723bs: cleanup return in sdio_init() Omer El Idrissi
2026-03-26  8:16   ` [PATCH v3 3/4] staging: rtl8723bs: clean up callees for sdio_init function Omer El Idrissi
2026-03-26  8:16   ` [PATCH v3 4/4] staging: rtl8723bs: Choose slightly more readable error check Omer El Idrissi
2026-03-26  8:39   ` [PATCH v3 0/4] clean up error handling Dan Carpenter
2026-03-26 10:36   ` Greg KH
2026-03-26 11:10     ` Omer
2026-03-26 14:49       ` Greg KH
2026-03-26  8:18 ` Omer El Idrissi
2026-03-26  8:18   ` [PATCH v3 1/4] staging: rtl8723bs: use direct returns in sdio_dvobj_init() Omer El Idrissi
2026-03-26  8:18   ` [PATCH v3 2/4] staging: rtl8723bs: cleanup return in sdio_init() Omer El Idrissi
2026-03-26  8:18   ` [PATCH v3 3/4] staging: rtl8723bs: clean up callees for sdio_init function Omer El Idrissi
2026-03-26  8:18   ` [PATCH v3 4/4] staging: rtl8723bs: Choose slightly more readable error check Omer El Idrissi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=acTeHqD9QZnM4Ob2@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=omer.e.idrissi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox