brcmfmac: fix leak of mypkt on error return path
Currently if the call to brcmf_sdiod_set_backplane_window fails then
error return path leaks mypkt. Fix this by returning by a new
error path labelled 'out' that calls brcmu_pkt_buf_free_skb to free
mypkt. Also remove redundant check on err before calling
brcmf_sdiod_skbuff_write.
Addresses-Coverity: ("Resource Leak")
Fixes: a7c3aa1509
("brcmfmac: Remove brcmf_sdiod_addrprep()")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
e3062e05e1
commit
a927e8d8ab
@ -628,15 +628,13 @@ int brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u8 *buf, uint nbytes)
|
||||
|
||||
err = brcmf_sdiod_set_backplane_window(sdiodev, addr);
|
||||
if (err)
|
||||
return err;
|
||||
goto out;
|
||||
|
||||
addr &= SBSDIO_SB_OFT_ADDR_MASK;
|
||||
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
|
||||
|
||||
if (!err)
|
||||
err = brcmf_sdiod_skbuff_write(sdiodev, sdiodev->func2, addr,
|
||||
mypkt);
|
||||
|
||||
err = brcmf_sdiod_skbuff_write(sdiodev, sdiodev->func2, addr, mypkt);
|
||||
out:
|
||||
brcmu_pkt_buf_free_skb(mypkt);
|
||||
|
||||
return err;
|
||||
|
Loading…
Reference in New Issue
Block a user