Skip to content

Commit

Permalink
brcmfmac: assure bcdc dcmd api does not return value > 0
Browse files Browse the repository at this point in the history
The protocol layer api defines callbacks for dongle commands.
Although not really well documented these should only return an
error code in case of an error, or 0 upon success. In the bcdc
protocol it can return value above 0 and we carry a fix in the
caller of the protocol layer api. This patch makes it adhere to
the intent of the api as described above.

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>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  • Loading branch information
Arend Van Spriel authored and Kalle Valo committed Jan 24, 2018
1 parent c93fe71 commit 5242a54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 5 additions & 1 deletion drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ brcmf_proto_bcdc_query_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd,
memcpy(buf, info, len);
}

ret = 0;

/* Check the ERROR flag */
if (flags & BCDC_DCMD_ERROR)
ret = le32_to_cpu(msg->status);
Expand All @@ -225,7 +227,7 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd,
{
struct brcmf_bcdc *bcdc = (struct brcmf_bcdc *)drvr->proto->pd;
struct brcmf_proto_bcdc_dcmd *msg = &bcdc->msg;
int ret = 0;
int ret;
u32 flags, id;

brcmf_dbg(BCDC, "Enter, cmd %d len %d\n", cmd, len);
Expand All @@ -249,6 +251,8 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_pub *drvr, int ifidx, uint cmd,
goto done;
}

ret = 0;

/* Check the ERROR flag */
if (flags & BCDC_DCMD_ERROR)
ret = le32_to_cpu(msg->status);
Expand Down
8 changes: 3 additions & 5 deletions drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,9 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void *data, u32 len, bool set)
else
err = brcmf_proto_query_dcmd(drvr, ifp->ifidx, cmd, data, len);

if (err >= 0)
return 0;

brcmf_dbg(FIL, "Failed: %s (%d)\n",
brcmf_fil_get_errstr((u32)(-err)), err);
if (err)
brcmf_dbg(FIL, "Failed: %s (%d)\n",
brcmf_fil_get_errstr((u32)(-err)), err);

return err;
}
Expand Down

0 comments on commit 5242a54

Please sign in to comment.