Re: [PATCH wireless-next v2 10/12] wifi: cw1200: check sdio_enable_func() and IRQ subscribe errors

From: Ulf Hansson

Date: Tue Dec 01 2026 - 03:47:58 EST


On Tue, Dec 1, 2026 at 9:40 AM Arthur Heymans <arthur@xxxxxxxxxxxx> wrote:
>
> cw1200_sdio_probe() ignores the return value of sdio_enable_func() and
> overwrites the status from cw1200_sdio_irq_subscribe() before checking
> it. Handle both errors and unwind setup on failure.
>
> Fixes: a910e4a94f69 ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets")
> Signed-off-by: Arthur Heymans <arthur@xxxxxxxxxxxx>

Reviewed-by: Ulf Hansson <ulfh@xxxxxxxxxx>

Kind regards
Uffe

> ---
> drivers/net/wireless/st/cw1200/cw1200_sdio.c | 24 ++++++++++++--------
> 1 file changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/wireless/st/cw1200/cw1200_sdio.c b/drivers/net/wireless/st/cw1200/cw1200_sdio.c
> index 2f25cf0028eb..b992f6cd6e79 100644
> --- a/drivers/net/wireless/st/cw1200/cw1200_sdio.c
> +++ b/drivers/net/wireless/st/cw1200/cw1200_sdio.c
> @@ -330,10 +330,14 @@ static int cw1200_sdio_probe(struct sdio_func *func,
> self->func = func;
> sdio_set_drvdata(func, self);
> sdio_claim_host(func);
> - sdio_enable_func(func);
> + status = sdio_enable_func(func);
> sdio_release_host(func);
> + if (status)
> + goto clear_drvdata;
>
> status = cw1200_sdio_irq_subscribe(self);
> + if (status)
> + goto disable_func;
>
> status = cw1200_core_probe(&cw1200_sdio_hwbus_ops,
> self, &func->dev, &self->core,
> @@ -341,15 +345,17 @@ static int cw1200_sdio_probe(struct sdio_func *func,
> self->pdata->macaddr,
> self->pdata->sdd_file,
> self->pdata->have_5ghz);
> - if (status) {
> - cw1200_sdio_irq_unsubscribe(self);
> - sdio_claim_host(func);
> - sdio_disable_func(func);
> - sdio_release_host(func);
> - sdio_set_drvdata(func, NULL);
> - kfree(self);
> - }
> + if (!status)
> + return 0;
>
> + cw1200_sdio_irq_unsubscribe(self);
> +disable_func:
> + sdio_claim_host(func);
> + sdio_disable_func(func);
> + sdio_release_host(func);
> +clear_drvdata:
> + sdio_set_drvdata(func, NULL);
> + kfree(self);
> return status;
> }
>
> --
> 2.56.0
>