public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] [PATCH] staging: rtl8723bs: change error handling to use standard errno
@ 2026-03-20  7:29 Omer El Idrissi
  2026-03-20  7:35 ` Greg KH
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Omer El Idrissi @ 2026-03-20  7:29 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Omer El Idrissi

Replace non-standard return values with descriptive
linux kernel error codes in probe path.
Also replace the variable name 'status' with 'ret'
to be more consistent with other kernel code

Signed-off-by: Omer El Idrissi <omer.e.idrissi@gmail.com>
---
 drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 30 +++++++++++++-------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
index d664e254912c..ff0ebcb59c68 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
@@ -345,38 +345,46 @@ static int rtw_drv_init(
 	struct sdio_func *func,
 	const struct sdio_device_id *id)
 {
-	int status = _FAIL;
+	int ret;
 	struct adapter *if1 = NULL;
 	struct dvobj_priv *dvobj;
 
 	dvobj = sdio_dvobj_init(func);
-	if (!dvobj)
+	if (!dvobj) {
+		ret = -ENOMEM;
 		goto exit;
+	}
 
 	if1 = rtw_sdio_if1_init(dvobj, id);
-	if (!if1)
+	if (!if1) {
+		ret = -ENOMEM;
 		goto free_dvobj;
+	}
 
 	/* dev_alloc_name && register_netdev */
-	status = rtw_drv_register_netdev(if1);
-	if (status != _SUCCESS)
+	ret = rtw_drv_register_netdev(if1);
+	if (ret) {
+		ret = -EIO;
 		goto free_if1;
+	}
 
-	status = sdio_alloc_irq(dvobj);
-	if (status != _SUCCESS)
+	ret = sdio_alloc_irq(dvobj);
+	if (ret) {
+		ret = -EIO;
 		goto free_if1;
+	}
 
-	status = _SUCCESS;
+	ret = _SUCCESS;
 
 free_if1:
-	if (status != _SUCCESS && if1)
+	if (ret != _SUCCESS && if1)
 		rtw_sdio_if1_deinit(if1);
 
 free_dvobj:
-	if (status != _SUCCESS)
+	if (ret != _SUCCESS)
 		sdio_dvobj_deinit(func);
 exit:
-	return status == _SUCCESS ? 0 : -ENODEV;
+	return ret;
 }
 
 static void rtw_dev_remove(struct sdio_func *func)
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] [PATCH] staging: rtl8723bs: change error handling to use standard errno
  2026-03-20  7:29 [PATCH] [PATCH] staging: rtl8723bs: change error handling to use standard errno Omer El Idrissi
@ 2026-03-20  7:35 ` Greg KH
  2026-03-20  7:36 ` Greg KH
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2026-03-20  7:35 UTC (permalink / raw)
  To: Omer El Idrissi; +Cc: linux-staging, linux-kernel

On Fri, Mar 20, 2026 at 08:29:50AM +0100, Omer El Idrissi wrote:
> Replace non-standard return values with descriptive
> linux kernel error codes in probe path.
> Also replace the variable name 'status' with 'ret'
> to be more consistent with other kernel code
> 
> Signed-off-by: Omer El Idrissi <omer.e.idrissi@gmail.com>
> ---
>  drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 30 +++++++++++++-------
>  1 file changed, 19 insertions(+), 11 deletions(-)

Your suject line is a bit odd, why two [PATCH] strings?

Also, you can use the full 72 columns in the changelog body.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] [PATCH] staging: rtl8723bs: change error handling to use standard errno
  2026-03-20  7:29 [PATCH] [PATCH] staging: rtl8723bs: change error handling to use standard errno Omer El Idrissi
  2026-03-20  7:35 ` Greg KH
@ 2026-03-20  7:36 ` Greg KH
       [not found]   ` <CACx49NfzUuHWdvME+850gJXLL==6x8Yw3_0yzZgJmAk089a7Aw@mail.gmail.com>
  2026-03-20  9:48 ` [PATCH v2] " Omer El Idrissi
  2026-03-21 20:17 ` Omer El Idrissi
  3 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2026-03-20  7:36 UTC (permalink / raw)
  To: Omer El Idrissi; +Cc: linux-staging, linux-kernel

On Fri, Mar 20, 2026 at 08:29:50AM +0100, Omer El Idrissi wrote:
> Replace non-standard return values with descriptive
> linux kernel error codes in probe path.
> Also replace the variable name 'status' with 'ret'
> to be more consistent with other kernel code
> 
> Signed-off-by: Omer El Idrissi <omer.e.idrissi@gmail.com>
> ---
>  drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 30 +++++++++++++-------
>  1 file changed, 19 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
> index d664e254912c..ff0ebcb59c68 100644
> --- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
> +++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
> @@ -345,38 +345,46 @@ static int rtw_drv_init(
>  	struct sdio_func *func,
>  	const struct sdio_device_id *id)
>  {
> -	int status = _FAIL;
> +	int ret;
>  	struct adapter *if1 = NULL;
>  	struct dvobj_priv *dvobj;
>  
>  	dvobj = sdio_dvobj_init(func);
> -	if (!dvobj)
> +	if (!dvobj) {
> +		ret = -ENOMEM;

why is this an "out of memory" error?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] [PATCH] staging: rtl8723bs: change error handling to use standard errno
       [not found]   ` <CACx49NfzUuHWdvME+850gJXLL==6x8Yw3_0yzZgJmAk089a7Aw@mail.gmail.com>
@ 2026-03-20  8:47     ` Omer
  0 siblings, 0 replies; 9+ messages in thread
From: Omer @ 2026-03-20  8:47 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-staging, linux-kernel

thank you for replying.

I've now read the sdio_dvobj_init source code and realized it also returns NULL
after non-malloc related problems so i'm going to change it from -ENOMEM to
-ENODEV.

Apologies for the double [PATCH] prefix, it was unintentionally put there.

best,

Omer El Idrissi


On Fri, Mar 20, 2026 at 9:43 AM Omer <omer.e.idrissi@gmail.com> wrote:
>
> thank you for replying.
>
> On Fri, Mar 20, 2026 at 8:36 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>>
>> On Fri, Mar 20, 2026 at 08:29:50AM +0100, Omer El Idrissi wrote:
>> > Replace non-standard return values with descriptive
>> > linux kernel error codes in probe path.
>> > Also replace the variable name 'status' with 'ret'
>> > to be more consistent with other kernel code
>> >
>> > Signed-off-by: Omer El Idrissi <omer.e.idrissi@gmail.com>
>> > ---
>> >  drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 30 +++++++++++++-------
>> >  1 file changed, 19 insertions(+), 11 deletions(-)
>> >
>> > diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
>> > index d664e254912c..ff0ebcb59c68 100644
>> > --- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
>> > +++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
>> > @@ -345,38 +345,46 @@ static int rtw_drv_init(
>> >       struct sdio_func *func,
>> >       const struct sdio_device_id *id)
>> >  {
>> > -     int status = _FAIL;
>> > +     int ret;
>> >       struct adapter *if1 = NULL;
>> >       struct dvobj_priv *dvobj;
>> >
>> >       dvobj = sdio_dvobj_init(func);
>> > -     if (!dvobj)
>> > +     if (!dvobj) {
>> > +             ret = -ENOMEM;
>>
>> why is this an "out of memory" error?
>>
>> thanks,
>>
>> greg k-h
>
>
> I've now read the sdio_dvobj_init source code and realized it also returns NULL
> after non-malloc related problems so i'm going to change it from -ENOMEM to
> -ENODEV.
>
> Apologies for the double [PATCH] prefix, I unintentionally put it there.
>
> best,
>
> Omer El Idrissi

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] staging: rtl8723bs: change error handling to use standard errno
  2026-03-20  7:29 [PATCH] [PATCH] staging: rtl8723bs: change error handling to use standard errno Omer El Idrissi
  2026-03-20  7:35 ` Greg KH
  2026-03-20  7:36 ` Greg KH
@ 2026-03-20  9:48 ` Omer El Idrissi
  2026-03-21  7:03   ` Greg KH
  2026-03-21 20:17 ` Omer El Idrissi
  3 siblings, 1 reply; 9+ messages in thread
From: Omer El Idrissi @ 2026-03-20  9:48 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Omer El Idrissi

Replace non-standard return values with descriptive linux kernel error
codes in probe path.
Also replace the variable name 'status' with 'ret' to be more
consistent with other kernel code.

Changes since v1:
-- Replace -ENOMEM with -ENODEV for sdio_dvobj_init fail path

Signed-off-by: Omer El Idrissi <omer.e.idrissi@gmail.com>
---
 drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 30 +++++++++++++-------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
index d664e254912c..4c16c514ca39 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
@@ -345,38 +345,46 @@ static int rtw_drv_init(
 	struct sdio_func *func,
 	const struct sdio_device_id *id)
 {
-	int status = _FAIL;
+	int ret;
 	struct adapter *if1 = NULL;
 	struct dvobj_priv *dvobj;
 
 	dvobj = sdio_dvobj_init(func);
-	if (!dvobj)
+	if (!dvobj) {
+		ret = -ENODEV;
 		goto exit;
+	}
 
 	if1 = rtw_sdio_if1_init(dvobj, id);
-	if (!if1)
+	if (!if1) {
+		ret = -ENOMEM;
 		goto free_dvobj;
+	}
 
 	/* dev_alloc_name && register_netdev */
-	status = rtw_drv_register_netdev(if1);
-	if (status != _SUCCESS)
+	ret = rtw_drv_register_netdev(if1);
+	if (ret) {
+		ret = -EIO;
 		goto free_if1;
+	}
 
-	status = sdio_alloc_irq(dvobj);
-	if (status != _SUCCESS)
+	ret = sdio_alloc_irq(dvobj);
+	if (ret) {
+		ret = -EIO;
 		goto free_if1;
+	}
 
-	status = _SUCCESS;
+	ret = _SUCCESS;
 
 free_if1:
-	if (status != _SUCCESS && if1)
+	if (ret != _SUCCESS && if1)
 		rtw_sdio_if1_deinit(if1);
 
 free_dvobj:
-	if (status != _SUCCESS)
+	if (ret != _SUCCESS)
 		sdio_dvobj_deinit(func);
 exit:
-	return status == _SUCCESS ? 0 : -ENODEV;
+	return ret;
 }
 
 static void rtw_dev_remove(struct sdio_func *func)
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] staging: rtl8723bs: change error handling to use standard errno
  2026-03-20  9:48 ` [PATCH v2] " Omer El Idrissi
@ 2026-03-21  7:03   ` Greg KH
  0 siblings, 0 replies; 9+ messages in thread
From: Greg KH @ 2026-03-21  7:03 UTC (permalink / raw)
  To: Omer El Idrissi; +Cc: linux-staging, linux-kernel

On Fri, Mar 20, 2026 at 10:48:24AM +0100, Omer El Idrissi wrote:
> Replace non-standard return values with descriptive linux kernel error
> codes in probe path.
> Also replace the variable name 'status' with 'ret' to be more
> consistent with other kernel code.
> 
> Changes since v1:
> -- Replace -ENOMEM with -ENODEV for sdio_dvobj_init fail path
> 
> Signed-off-by: Omer El Idrissi <omer.e.idrissi@gmail.com>
> ---
>  drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 30 +++++++++++++-------
>  1 file changed, 19 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
> index d664e254912c..4c16c514ca39 100644
> --- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
> +++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
> @@ -345,38 +345,46 @@ static int rtw_drv_init(
>  	struct sdio_func *func,
>  	const struct sdio_device_id *id)
>  {
> -	int status = _FAIL;
> +	int ret;
>  	struct adapter *if1 = NULL;
>  	struct dvobj_priv *dvobj;
>  
>  	dvobj = sdio_dvobj_init(func);
> -	if (!dvobj)
> +	if (!dvobj) {
> +		ret = -ENODEV;
>  		goto exit;
> +	}
>  
>  	if1 = rtw_sdio_if1_init(dvobj, id);
> -	if (!if1)
> +	if (!if1) {
> +		ret = -ENOMEM;
>  		goto free_dvobj;
> +	}
>  
>  	/* dev_alloc_name && register_netdev */
> -	status = rtw_drv_register_netdev(if1);
> -	if (status != _SUCCESS)
> +	ret = rtw_drv_register_netdev(if1);
> +	if (ret) {
> +		ret = -EIO;
>  		goto free_if1;
> +	}
>  
> -	status = sdio_alloc_irq(dvobj);
> -	if (status != _SUCCESS)
> +	ret = sdio_alloc_irq(dvobj);
> +	if (ret) {
> +		ret = -EIO;
>  		goto free_if1;
> +	}
>  
> -	status = _SUCCESS;
> +	ret = _SUCCESS;
>  
>  free_if1:
> -	if (status != _SUCCESS && if1)
> +	if (ret != _SUCCESS && if1)
>  		rtw_sdio_if1_deinit(if1);
>  
>  free_dvobj:
> -	if (status != _SUCCESS)
> +	if (ret != _SUCCESS)
>  		sdio_dvobj_deinit(func);
>  exit:
> -	return status == _SUCCESS ? 0 : -ENODEV;
> +	return ret;
>  }
>  
>  static void rtw_dev_remove(struct sdio_func *func)
> -- 
> 2.51.0
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- This looks like a new version of a previously submitted patch, but you
  did not list below the --- line any changes from the previous version.
  Please read the section entitled "The canonical patch format" in the
  kernel file, Documentation/process/submitting-patches.rst for what
  needs to be done here to properly describe this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] staging: rtl8723bs: change error handling to use standard errno
  2026-03-20  7:29 [PATCH] [PATCH] staging: rtl8723bs: change error handling to use standard errno Omer El Idrissi
                   ` (2 preceding siblings ...)
  2026-03-20  9:48 ` [PATCH v2] " Omer El Idrissi
@ 2026-03-21 20:17 ` Omer El Idrissi
  2026-03-21 21:24   ` Dan Carpenter
  3 siblings, 1 reply; 9+ messages in thread
From: Omer El Idrissi @ 2026-03-21 20:17 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Omer El Idrissi

Replace non-standard return values with descriptive linux kernel error
codes in probe path.
Also replace the variable name 'status' with 'ret' to be more
consistent with other kernel code.

Signed-off-by: Omer El Idrissi <omer.e.idrissi@gmail.com>

---
v2:
- Return -ENODEV instead of -ENOMEM when sdio_dvobj_init fails

 drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 30 ++++++++++++--------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
index d664e254912c..47189c849b05 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
@@ -345,38 +345,44 @@ static int rtw_drv_init(
 	struct sdio_func *func,
 	const struct sdio_device_id *id)
 {
-	int status = _FAIL;
+	int ret;
 	struct adapter *if1 = NULL;
 	struct dvobj_priv *dvobj;
 
 	dvobj = sdio_dvobj_init(func);
-	if (!dvobj)
+	if (!dvobj) {
+		ret = -ENODEV;
 		goto exit;
+	}
 
 	if1 = rtw_sdio_if1_init(dvobj, id);
-	if (!if1)
+	if (!if1) {
+		ret = -ENOMEM;
 		goto free_dvobj;
+	}
 
 	/* dev_alloc_name && register_netdev */
-	status = rtw_drv_register_netdev(if1);
-	if (status != _SUCCESS)
+	ret = rtw_drv_register_netdev(if1);
+	if (ret) {
+		ret = -EIO;
 		goto free_if1;
+	}
 
-	status = sdio_alloc_irq(dvobj);
-	if (status != _SUCCESS)
+	ret = sdio_alloc_irq(dvobj);
+	if (ret) {
+		ret = -EIO;
 		goto free_if1;
-
-	status = _SUCCESS;
+	}
 
 free_if1:
-	if (status != _SUCCESS && if1)
+	if (ret && if1)
 		rtw_sdio_if1_deinit(if1);
 
 free_dvobj:
-	if (status != _SUCCESS)
+	if (ret)
 		sdio_dvobj_deinit(func);
 exit:
-	return status == _SUCCESS ? 0 : -ENODEV;
+	return ret;
 }
 
 static void rtw_dev_remove(struct sdio_func *func)
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] staging: rtl8723bs: change error handling to use standard errno
  2026-03-21 20:17 ` Omer El Idrissi
@ 2026-03-21 21:24   ` Dan Carpenter
  2026-03-21 21:34     ` Omer
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Carpenter @ 2026-03-21 21:24 UTC (permalink / raw)
  To: Omer El Idrissi; +Cc: gregkh, linux-staging, linux-kernel

On Sat, Mar 21, 2026 at 09:17:38PM +0100, Omer El Idrissi wrote:
> Replace non-standard return values with descriptive linux kernel error
> codes in probe path.
> Also replace the variable name 'status' with 'ret' to be more
> consistent with other kernel code.
> 
> Signed-off-by: Omer El Idrissi <omer.e.idrissi@gmail.com>
> 
> ---
> v2:
> - Return -ENODEV instead of -ENOMEM when sdio_dvobj_init fails
> 
>  drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 30 ++++++++++++--------
>  1 file changed, 18 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
> index d664e254912c..47189c849b05 100644
> --- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
> +++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
> @@ -345,38 +345,44 @@ static int rtw_drv_init(
>  	struct sdio_func *func,
>  	const struct sdio_device_id *id)
>  {
> -	int status = _FAIL;
> +	int ret;
>  	struct adapter *if1 = NULL;
>  	struct dvobj_priv *dvobj;
>  
>  	dvobj = sdio_dvobj_init(func);
> -	if (!dvobj)
> +	if (!dvobj) {
> +		ret = -ENODEV;
>  		goto exit;
> +	}
>  
>  	if1 = rtw_sdio_if1_init(dvobj, id);
> -	if (!if1)
> +	if (!if1) {
> +		ret = -ENOMEM;
>  		goto free_dvobj;
> +	}
>  
>  	/* dev_alloc_name && register_netdev */
> -	status = rtw_drv_register_netdev(if1);
> -	if (status != _SUCCESS)
> +	ret = rtw_drv_register_netdev(if1);
> +	if (ret) {
> +		ret = -EIO;
>  		goto free_if1;
> +	}


rtw_drv_register_netdev() doesn't return regular error codes
but when you change:

-	if (status != _SUCCESS) {
+	if (ret) {

Then you're making it look like it does, which is confusing.

You're going about this the wrong way.  You need to start with
functions like _rtw_drv_register_netdev() which are where
the _SUCCESS returns are first returned and change those first.
You have to update the callers as you go.  It's tricky because
you have to be sure you're catching all the callers.

Then eventually, you'll get back to rtw_drv_init() and all the
functions it call will return normal error codes and you can
update that.

Do it one function at a time.  Update the function and the
callers.  Something like this:

regards,
dan carpenter

[patch] update error code for rtw_init_netdev_name()

The rtw_init_netdev_name() returns 1 on failure and 0 on success
which is non-standard.  Change it to propagate the error from
dev_alloc_name() and update the only caller.

diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
index 7ba689f2dfc8..92b52b1a2920 100644
--- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
@@ -407,9 +407,12 @@ static const struct net_device_ops rtw_netdev_ops = {
 
 int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname)
 {
-	if (dev_alloc_name(pnetdev, ifname) < 0) {
+	int ret;
+
+	ret = dev_alloc_name(pnetdev, ifname);
+	if (ret < 0) {
 		pr_err("dev_alloc_name, fail for %s\n", ifname);
-		return 1;
+		return ret;
 	}
 	netif_carrier_off(pnetdev);
 	/* rtw_netif_stop_queue(pnetdev); */
@@ -755,7 +758,8 @@ static int _rtw_drv_register_netdev(struct adapter *padapter, char *name)
 	struct net_device *pnetdev = padapter->pnetdev;
 
 	/* alloc netdev name */
-	if (rtw_init_netdev_name(pnetdev, name))
+	ret = rtw_init_netdev_name(pnetdev, name);
+	if (ret)
 		return _FAIL;
 
 	eth_hw_addr_set(pnetdev, padapter->eeprompriv.mac_addr);

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] staging: rtl8723bs: change error handling to use standard errno
  2026-03-21 21:24   ` Dan Carpenter
@ 2026-03-21 21:34     ` Omer
  0 siblings, 0 replies; 9+ messages in thread
From: Omer @ 2026-03-21 21:34 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: gregkh, linux-staging, linux-kernel

Thank you for responding sir.

Most of the functions called in the probe function are only called
there so it should be easier to fix.

I will move on to do that.

On Sat, Mar 21, 2026 at 10:24 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> On Sat, Mar 21, 2026 at 09:17:38PM +0100, Omer El Idrissi wrote:
> > Replace non-standard return values with descriptive linux kernel error
> > codes in probe path.
> > Also replace the variable name 'status' with 'ret' to be more
> > consistent with other kernel code.
> >
> > Signed-off-by: Omer El Idrissi <omer.e.idrissi@gmail.com>
> >
> > ---
> > v2:
> > - Return -ENODEV instead of -ENOMEM when sdio_dvobj_init fails
> >
> >  drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 30 ++++++++++++--------
> >  1 file changed, 18 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
> > index d664e254912c..47189c849b05 100644
> > --- a/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
> > +++ b/drivers/staging/rtl8723bs/os_dep/sdio_intf.c
> > @@ -345,38 +345,44 @@ static int rtw_drv_init(
> >       struct sdio_func *func,
> >       const struct sdio_device_id *id)
> >  {
> > -     int status = _FAIL;
> > +     int ret;
> >       struct adapter *if1 = NULL;
> >       struct dvobj_priv *dvobj;
> >
> >       dvobj = sdio_dvobj_init(func);
> > -     if (!dvobj)
> > +     if (!dvobj) {
> > +             ret = -ENODEV;
> >               goto exit;
> > +     }
> >
> >       if1 = rtw_sdio_if1_init(dvobj, id);
> > -     if (!if1)
> > +     if (!if1) {
> > +             ret = -ENOMEM;
> >               goto free_dvobj;
> > +     }
> >
> >       /* dev_alloc_name && register_netdev */
> > -     status = rtw_drv_register_netdev(if1);
> > -     if (status != _SUCCESS)
> > +     ret = rtw_drv_register_netdev(if1);
> > +     if (ret) {
> > +             ret = -EIO;
> >               goto free_if1;
> > +     }
>
>
> rtw_drv_register_netdev() doesn't return regular error codes
> but when you change:
>
> -       if (status != _SUCCESS) {
> +       if (ret) {
>
> Then you're making it look like it does, which is confusing.
>
> You're going about this the wrong way.  You need to start with
> functions like _rtw_drv_register_netdev() which are where
> the _SUCCESS returns are first returned and change those first.
> You have to update the callers as you go.  It's tricky because
> you have to be sure you're catching all the callers.
>
> Then eventually, you'll get back to rtw_drv_init() and all the
> functions it call will return normal error codes and you can
> update that.
>
> Do it one function at a time.  Update the function and the
> callers.  Something like this:
>
> regards,
> dan carpenter
>
> [patch] update error code for rtw_init_netdev_name()
>
> The rtw_init_netdev_name() returns 1 on failure and 0 on success
> which is non-standard.  Change it to propagate the error from
> dev_alloc_name() and update the only caller.
>
> diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> index 7ba689f2dfc8..92b52b1a2920 100644
> --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> @@ -407,9 +407,12 @@ static const struct net_device_ops rtw_netdev_ops = {
>
>  int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname)
>  {
> -       if (dev_alloc_name(pnetdev, ifname) < 0) {
> +       int ret;
> +
> +       ret = dev_alloc_name(pnetdev, ifname);
> +       if (ret < 0) {
>                 pr_err("dev_alloc_name, fail for %s\n", ifname);
> -               return 1;
> +               return ret;
>         }
>         netif_carrier_off(pnetdev);
>         /* rtw_netif_stop_queue(pnetdev); */
> @@ -755,7 +758,8 @@ static int _rtw_drv_register_netdev(struct adapter *padapter, char *name)
>         struct net_device *pnetdev = padapter->pnetdev;
>
>         /* alloc netdev name */
> -       if (rtw_init_netdev_name(pnetdev, name))
> +       ret = rtw_init_netdev_name(pnetdev, name);
> +       if (ret)
>                 return _FAIL;
>
>         eth_hw_addr_set(pnetdev, padapter->eeprompriv.mac_addr);

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-03-21 21:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20  7:29 [PATCH] [PATCH] staging: rtl8723bs: change error handling to use standard errno Omer El Idrissi
2026-03-20  7:35 ` Greg KH
2026-03-20  7:36 ` Greg KH
     [not found]   ` <CACx49NfzUuHWdvME+850gJXLL==6x8Yw3_0yzZgJmAk089a7Aw@mail.gmail.com>
2026-03-20  8:47     ` Omer
2026-03-20  9:48 ` [PATCH v2] " Omer El Idrissi
2026-03-21  7:03   ` Greg KH
2026-03-21 20:17 ` Omer El Idrissi
2026-03-21 21:24   ` Dan Carpenter
2026-03-21 21:34     ` Omer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox