Commit fcaac2b1 authored by Arend van Spriel's avatar Arend van Spriel Committed by John W. Linville

brcmfmac: verify result of brcmf_sdio_addrprep() calls

Not all calls to the function brcmf_sdio_addrprep() check
the return value, but it may fail so better verify it.
Reviewed-by: default avatarFranky Lin <frankyl@broadcom.com>
Reviewed-by: default avatarHante Meuleman <meuleman@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 4aef267e
...@@ -238,7 +238,9 @@ brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr, ...@@ -238,7 +238,9 @@ brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr,
func_num = SDIO_FUNC_1; func_num = SDIO_FUNC_1;
reg_size = 4; reg_size = 4;
brcmf_sdio_addrprep(sdiodev, reg_size, &addr); ret = brcmf_sdio_addrprep(sdiodev, reg_size, &addr);
if (ret)
goto done;
} }
do { do {
...@@ -254,6 +256,7 @@ brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr, ...@@ -254,6 +256,7 @@ brcmf_sdio_regrw_helper(struct brcmf_sdio_dev *sdiodev, u32 addr,
func_num, addr, data, 4); func_num, addr, data, 4);
} while (ret != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT); } while (ret != 0 && retry++ < SDIOH_API_ACCESS_RETRY_LIMIT);
done:
if (ret != 0) if (ret != 0)
brcmf_err("failed with %d\n", ret); brcmf_err("failed with %d\n", ret);
...@@ -605,9 +608,10 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, ...@@ -605,9 +608,10 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
memcpy(mypkt->data, buf, nbytes); memcpy(mypkt->data, buf, nbytes);
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2; width = (flags & SDIO_REQ_4BYTE) ? 4 : 2;
brcmf_sdio_addrprep(sdiodev, width, &addr); err = brcmf_sdio_addrprep(sdiodev, width, &addr);
err = brcmf_sdio_buffrw(sdiodev, fn, true, addr, mypkt); if (!err)
err = brcmf_sdio_buffrw(sdiodev, fn, true, addr, mypkt);
brcmu_pkt_buf_free_skb(mypkt); brcmu_pkt_buf_free_skb(mypkt);
return err; return err;
...@@ -619,12 +623,15 @@ brcmf_sdcard_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn, ...@@ -619,12 +623,15 @@ brcmf_sdcard_send_pkt(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
uint flags, struct sk_buff_head *pktq) uint flags, struct sk_buff_head *pktq)
{ {
uint width; uint width;
int err;
brcmf_dbg(SDIO, "fun = %d, addr = 0x%x, size = %d\n", brcmf_dbg(SDIO, "fun = %d, addr = 0x%x, size = %d\n",
fn, addr, pktq->qlen); fn, addr, pktq->qlen);
width = (flags & SDIO_REQ_4BYTE) ? 4 : 2; width = (flags & SDIO_REQ_4BYTE) ? 4 : 2;
brcmf_sdio_addrprep(sdiodev, width, &addr); err = brcmf_sdio_addrprep(sdiodev, width, &addr);
if (err)
return err;
if (pktq->qlen == 1) if (pktq->qlen == 1)
return brcmf_sdio_buffrw(sdiodev, fn, true, addr, pktq->next); return brcmf_sdio_buffrw(sdiodev, fn, true, addr, pktq->next);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment