MLK-21492 brcmfmac: remove func0 that is not provied by mmc stack
authorFugang Duan <fugang.duan@nxp.com>
Thu, 18 Apr 2019 06:50:34 +0000 (14:50 +0800)
committerFugang Duan <fugang.duan@nxp.com>
Thu, 18 Apr 2019 09:08:06 +0000 (17:08 +0800)
func0 is not provided by the mmc stack as a function when probing.
commit 99d7b6fdfc8c(brcmfmac: Remove func0 from function array)
already remove the func0.

But commit c37fa19e0128(brcmfmac: Remove array of functions) add
fun0 again. That cause NULL pointer issue.

Fixes: c37fa19e0128(brcmfmac: Remove array of functions)
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h

index 86c16df..b656901 100644 (file)
@@ -918,7 +918,7 @@ static int brcmf_sdiod_probe(struct brcmf_sdio_dev *sdiodev)
                goto out;
        }
 
-       if (sdiodev->func0->device == SDIO_DEVICE_ID_CYPRESS_4373) {
+       if (sdiodev->func1->device == SDIO_DEVICE_ID_CYPRESS_4373) {
                f2_blksz = SDIO_4373_FUNC2_BLOCKSIZE;
        }
 
index d0054d7..62c39c3 100644 (file)
@@ -4328,7 +4328,7 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err,
                bus->hostintmask = HOSTINTMASK;
                brcmf_sdiod_writel(sdiod, core->base + SD_REG(hostintmask),
                                   bus->hostintmask, NULL);
-               switch (sdiod->func0->device) {
+               switch (sdiod->func1->device) {
                case SDIO_DEVICE_ID_CYPRESS_4373:
                        brcmf_dbg(INFO, "set F2 watermark to 0x%x*4 bytes\n",
                                  CY_4373_F2_WATERMARK);
@@ -4417,7 +4417,8 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err,
        err = brcmf_attach(sdiod->dev, sdiod->settings);
        if (err != 0) {
                brcmf_err("brcmf_attach failed\n");
-               goto fail;
+               sdio_claim_host(sdiod->func1);
+               goto release;
        }
 
        /* ready */
index 9c5c0dc..a54ce44 100644 (file)
@@ -183,7 +183,6 @@ struct fmac_ulp {
 };
 
 struct brcmf_sdio_dev {
-       struct sdio_func *func0;
        struct sdio_func *func1;
        struct sdio_func *func2;
        u32 sbwad;                      /* Save backplane window address */