brcm63xx: Add Observa VH4032N support
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / 318-brcmfmac-check-brcmf_bus_get_memdump-result-for-erro.patch
1 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
2 Date: Mon, 30 Jan 2017 16:09:51 +0100
3 Subject: [PATCH] brcmfmac: check brcmf_bus_get_memdump result for error
4 MIME-Version: 1.0
5 Content-Type: text/plain; charset=UTF-8
6 Content-Transfer-Encoding: 8bit
7
8 This method may be unsupported (see: USB bus) or may just fail (see:
9 SDIO bus).
10 While at it rework logic in brcmf_sdio_bus_get_memdump function to avoid
11 too many conditional code nesting levels.
12
13 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
14 Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
15 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
16 ---
17
18 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
19 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c
20 @@ -32,16 +32,25 @@ static int brcmf_debug_create_memdump(st
21 {
22 void *dump;
23 size_t ramsize;
24 + int err;
25
26 ramsize = brcmf_bus_get_ramsize(bus);
27 - if (ramsize) {
28 - dump = vzalloc(len + ramsize);
29 - if (!dump)
30 - return -ENOMEM;
31 - memcpy(dump, data, len);
32 - brcmf_bus_get_memdump(bus, dump + len, ramsize);
33 - dev_coredumpv(bus->dev, dump, len + ramsize, GFP_KERNEL);
34 + if (!ramsize)
35 + return -ENOTSUPP;
36 +
37 + dump = vzalloc(len + ramsize);
38 + if (!dump)
39 + return -ENOMEM;
40 +
41 + memcpy(dump, data, len);
42 + err = brcmf_bus_get_memdump(bus, dump + len, ramsize);
43 + if (err) {
44 + vfree(dump);
45 + return err;
46 }
47 +
48 + dev_coredumpv(bus->dev, dump, len + ramsize, GFP_KERNEL);
49 +
50 return 0;
51 }
52