Linux wireless drivers development
 help / color / mirror / Atom feed
From: "Jérôme Pouiller" <jerome.pouiller@silabs.com>
To: kvalo@kernel.org, gregkh@linuxfoundation.org,
	linux-wireless@vger.kernel.org, Yuan Can <yuancan@huawei.com>
Subject: Re: [PATCH] wifi: wfx: Fix error handling in wfx_core_init()
Date: Tue, 22 Oct 2024 12:15:23 +0200	[thread overview]
Message-ID: <3950964.R56niFO833@nb0018864> (raw)
In-Reply-To: <20241022090453.84679-1-yuancan@huawei.com>

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



  parent reply	other threads:[~2024-10-22 10:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2024-10-31 14:18 ` Kalle Valo

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=3950964.R56niFO833@nb0018864 \
    --to=jerome.pouiller@silabs.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=yuancan@huawei.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