diff mbox

[RFT,3/3] brcmfmac: unbind all devices upon failure in firmware callback

Message ID 1496147754-2303-4-git-send-email-arend.vanspriel@broadcom.com (mailing list archive)
State RFC
Delegated to: Kalle Valo
Headers show

Commit Message

Arend van Spriel May 30, 2017, 12:35 p.m. UTC
In brcmf_sdio_firmware_callback() we need to unbind the driver from
both sdio_func devices.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Enric Balletbo Serra May 31, 2017, 11:13 a.m. UTC | #1
2017-05-30 14:35 GMT+02:00 Arend van Spriel <arend.vanspriel@broadcom.com>:
> In brcmf_sdio_firmware_callback() we need to unbind the driver from
> both sdio_func devices.
>
> Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
> Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
> Reviewed-by: Franky Lin <franky.lin@broadcom.com>
> Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> ---
>  drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
> index 270c0ad..a5b27a4 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
> @@ -3988,14 +3988,14 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err,
>         u8 saveclk;
>
>         brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err);
> +       bus_if = dev_get_drvdata(dev);
> +       sdiodev = bus_if->bus_priv.sdio;
>         if (err)
>                 goto fail;
>
> -       bus_if = dev_get_drvdata(dev);
>         if (!bus_if->drvr)
>                 return;
>
> -       sdiodev = bus_if->bus_priv.sdio;
>         bus = sdiodev->bus;
>
>         /* try to download image and nvram to the dongle */
> @@ -4084,6 +4084,7 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err,
>  fail:
>         brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err);
>         device_release_driver(dev);
> +       device_release_driver(&sdiodev->func[1]->dev);

missing device_release_driver(&sdiodev->func[2]->dev); ?

See my answers to the cover-letter.

>  }
>
>  struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
> --
> 1.9.1
>
diff mbox

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index 270c0ad..a5b27a4 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -3988,14 +3988,14 @@  static void brcmf_sdio_firmware_callback(struct device *dev, int err,
 	u8 saveclk;
 
 	brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err);
+	bus_if = dev_get_drvdata(dev);
+	sdiodev = bus_if->bus_priv.sdio;
 	if (err)
 		goto fail;
 
-	bus_if = dev_get_drvdata(dev);
 	if (!bus_if->drvr)
 		return;
 
-	sdiodev = bus_if->bus_priv.sdio;
 	bus = sdiodev->bus;
 
 	/* try to download image and nvram to the dongle */
@@ -4084,6 +4084,7 @@  static void brcmf_sdio_firmware_callback(struct device *dev, int err,
 fail:
 	brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err);
 	device_release_driver(dev);
+	device_release_driver(&sdiodev->func[1]->dev);
 }
 
 struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)