Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] wifi: wfx: Fix error handling in wfx_core_init()
@ 2024-10-22  9:04 Yuan Can
  2024-10-22  9:38 ` Greg KH
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yuan Can @ 2024-10-22  9:04 UTC (permalink / raw)
  To: jerome.pouiller, kvalo, gregkh, linux-wireless; +Cc: yuancan

The wfx_core_init() returns without checking the retval from
sdio_register_driver().
If the sdio_register_driver() failed, the module failed to install,
leaving the wfx_spi_driver not unregistered.

Fixes: a7a91ca5a23d ("staging: wfx: add infrastructure for new driver")
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
 drivers/net/wireless/silabs/wfx/main.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/silabs/wfx/main.c b/drivers/net/wireless/silabs/wfx/main.c
index e7198520bdff..64441c8bc460 100644
--- a/drivers/net/wireless/silabs/wfx/main.c
+++ b/drivers/net/wireless/silabs/wfx/main.c
@@ -480,10 +480,23 @@ static int __init wfx_core_init(void)
 {
 	int ret = 0;
 
-	if (IS_ENABLED(CONFIG_SPI))
+	if (IS_ENABLED(CONFIG_SPI)) {
 		ret = spi_register_driver(&wfx_spi_driver);
-	if (IS_ENABLED(CONFIG_MMC) && !ret)
+		if (ret)
+			goto out;
+	}
+	if (IS_ENABLED(CONFIG_MMC)) {
 		ret = sdio_register_driver(&wfx_sdio_driver);
+		if (ret)
+			goto unregister_spi;
+	}
+
+	return 0;
+
+unregister_spi:
+	if (IS_ENABLED(CONFIG_SPI))
+		spi_unregister_driver(&wfx_spi_driver);
+out:
 	return ret;
 }
 module_init(wfx_core_init);
-- 
2.17.1


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

* Re: [PATCH] wifi: wfx: Fix error handling in wfx_core_init()
  2024-10-22  9:04 [PATCH] wifi: wfx: Fix error handling in wfx_core_init() Yuan Can
@ 2024-10-22  9:38 ` Greg KH
  2024-10-22 10:15 ` Jérôme Pouiller
  2024-10-31 14:18 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2024-10-22  9:38 UTC (permalink / raw)
  To: Yuan Can; +Cc: jerome.pouiller, kvalo, linux-wireless

On Tue, Oct 22, 2024 at 05:04:53PM +0800, Yuan Can wrote:
> The wfx_core_init() returns without checking the retval from
> sdio_register_driver().
> If the sdio_register_driver() failed, the module failed to install,
> leaving the wfx_spi_driver not unregistered.
> 
> Fixes: a7a91ca5a23d ("staging: wfx: add infrastructure for new driver")
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> ---
>  drivers/net/wireless/silabs/wfx/main.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)

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:

- You have marked a patch with a "Fixes:" tag for a commit that is in an
  older released kernel, yet you do not have a cc: stable line in the
  signed-off-by area at all, which means that the patch will not be
  applied to any older kernel releases.  To properly fix this, please
  follow the documented rules in the
  Documentation/process/stable-kernel-rules.rst file for how to resolve
  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] 4+ messages in thread

* Re: [PATCH] wifi: wfx: Fix error handling in wfx_core_init()
  2024-10-22  9:04 [PATCH] wifi: wfx: Fix error handling in wfx_core_init() Yuan Can
  2024-10-22  9:38 ` Greg KH
@ 2024-10-22 10:15 ` Jérôme Pouiller
  2024-10-31 14:18 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Jérôme Pouiller @ 2024-10-22 10:15 UTC (permalink / raw)
  To: kvalo, gregkh, linux-wireless, Yuan Can

On Tuesday 22 October 2024 11:04:53 CEST Yuan Can wrote:
> The wfx_core_init() returns without checking the retval from
> sdio_register_driver().
> If the sdio_register_driver() failed, the module failed to install,
> leaving the wfx_spi_driver not unregistered.
> 
> Fixes: a7a91ca5a23d ("staging: wfx: add infrastructure for new driver")
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> ---
>  drivers/net/wireless/silabs/wfx/main.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/silabs/wfx/main.c b/drivers/net/wireless/silabs/wfx/main.c
> index e7198520bdff..64441c8bc460 100644
> --- a/drivers/net/wireless/silabs/wfx/main.c
> +++ b/drivers/net/wireless/silabs/wfx/main.c
> @@ -480,10 +480,23 @@ static int __init wfx_core_init(void)
>  {
>         int ret = 0;
> 
> -       if (IS_ENABLED(CONFIG_SPI))
> +       if (IS_ENABLED(CONFIG_SPI)) {
>                 ret = spi_register_driver(&wfx_spi_driver);
> -       if (IS_ENABLED(CONFIG_MMC) && !ret)
> +               if (ret)
> +                       goto out;
> +       }
> +       if (IS_ENABLED(CONFIG_MMC)) {
>                 ret = sdio_register_driver(&wfx_sdio_driver);
> +               if (ret)
> +                       goto unregister_spi;
> +       }
> +
> +       return 0;
> +
> +unregister_spi:
> +       if (IS_ENABLED(CONFIG_SPI))
> +               spi_unregister_driver(&wfx_spi_driver);
> +out:
>         return ret;
>  }
>  module_init(wfx_core_init);


Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>

-- 
Jérôme Pouiller



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

* Re: [PATCH] wifi: wfx: Fix error handling in wfx_core_init()
  2024-10-22  9:04 [PATCH] wifi: wfx: Fix error handling in wfx_core_init() Yuan Can
  2024-10-22  9:38 ` Greg KH
  2024-10-22 10:15 ` Jérôme Pouiller
@ 2024-10-31 14:18 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2024-10-31 14:18 UTC (permalink / raw)
  To: Yuan Can; +Cc: jerome.pouiller, gregkh, linux-wireless, yuancan

Yuan Can <yuancan@huawei.com> wrote:

> The wfx_core_init() returns without checking the retval from
> sdio_register_driver().
> If the sdio_register_driver() failed, the module failed to install,
> leaving the wfx_spi_driver not unregistered.
> 
> Fixes: a7a91ca5a23d ("staging: wfx: add infrastructure for new driver")
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>

Patch applied to wireless-next.git, thanks.

3b88a9876779 wifi: wfx: Fix error handling in wfx_core_init()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20241022090453.84679-1-yuancan@huawei.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, other threads:[~2024-10-31 14:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-22  9:04 [PATCH] wifi: wfx: Fix error handling in wfx_core_init() Yuan Can
2024-10-22  9:38 ` Greg KH
2024-10-22 10:15 ` Jérôme Pouiller
2024-10-31 14:18 ` Kalle Valo

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