394fbfc5b2e26cc2c72f7bf052e71a06266f11c1
[openwrt/staging/mkresin.git] /
1 From 5242a5444e0b6464d7455beb55d936dd192b5e9d Mon Sep 17 00:00:00 2001
2 From: Arend Van Spriel <arend.vanspriel@broadcom.com>
3 Date: Mon, 22 Jan 2018 21:46:39 +0100
4 Subject: [PATCH] brcmfmac: assure bcdc dcmd api does not return value > 0
5
6 The protocol layer api defines callbacks for dongle commands.
7 Although not really well documented these should only return an
8 error code in case of an error, or 0 upon success. In the bcdc
9 protocol it can return value above 0 and we carry a fix in the
10 caller of the protocol layer api. This patch makes it adhere to
11 the intent of the api as described above.
12
13 Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
14 Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
15 Reviewed-by: Franky Lin <franky.lin@broadcom.com>
16 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
17 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
18 ---
19 drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 6 +++++-
20 drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c | 8 +++-----
21 2 files changed, 8 insertions(+), 6 deletions(-)
22
23 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
24 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c
25 @@ -211,6 +211,8 @@ retry:
26 memcpy(buf, info, len);
27 }
28
29 + ret = 0;
30 +
31 /* Check the ERROR flag */
32 if (flags & BCDC_DCMD_ERROR)
33 ret = le32_to_cpu(msg->status);
34 @@ -225,7 +227,7 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_p
35 {
36 struct brcmf_bcdc *bcdc = (struct brcmf_bcdc *)drvr->proto->pd;
37 struct brcmf_proto_bcdc_dcmd *msg = &bcdc->msg;
38 - int ret = 0;
39 + int ret;
40 u32 flags, id;
41
42 brcmf_dbg(BCDC, "Enter, cmd %d len %d\n", cmd, len);
43 @@ -249,6 +251,8 @@ brcmf_proto_bcdc_set_dcmd(struct brcmf_p
44 goto done;
45 }
46
47 + ret = 0;
48 +
49 /* Check the ERROR flag */
50 if (flags & BCDC_DCMD_ERROR)
51 ret = le32_to_cpu(msg->status);
52 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
53 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.c
54 @@ -121,11 +121,9 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp,
55 else
56 err = brcmf_proto_query_dcmd(drvr, ifp->ifidx, cmd, data, len);
57
58 - if (err >= 0)
59 - return 0;
60 -
61 - brcmf_dbg(FIL, "Failed: %s (%d)\n",
62 - brcmf_fil_get_errstr((u32)(-err)), err);
63 + if (err)
64 + brcmf_dbg(FIL, "Failed: %s (%d)\n",
65 + brcmf_fil_get_errstr((u32)(-err)), err);
66
67 return err;
68 }