Skip to contentSkip to conversation

brcmfmac: check brcmf_bus_get_memdump result for error

PATCH In review Rafał Miłecki 3 participants 5 messages Jan 30, 2017 – Feb 2, 2017 Broadcom BRCM80211 IEEE802.11 wireless drivers

lore
Share & tools
lore
#1 lore raw

PATCH 2/2 brcmfmac: be more verbose when PSM's watchdog fires

In reply to Rafał Miłecki

From: Rafał Miłecki <[email protected]>

It's important to inform user so he knows things went wrong. He may also want to get memory dump for further debugging purposes.

---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c +10 -2
index 6f8a4b074c31..f4644cf371c7 100644
@@ -58,10 +58,18 @@ static int brcmf_debug_psm_watchdog_notify(struct brcmf_if *ifp,
 					   const struct brcmf_event_msg *evtmsg,
 					   void *data)
 {
+	int err;
+
 	brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx);
 
-	return brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
-					  evtmsg->datalen);
+	brcmf_err("PSM's watchdog has fired!\n");
+
+	err = brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
+					 evtmsg->datalen);
+	if (err)
+		brcmf_err("Failed to get memory dump, %d\n", err);
+
+	return err;
 }
 
 void brcmf_debugfs_init(void)
Signature · 1 line
2.11.0
#0 lore raw

PATCH 1/2 brcmfmac: check brcmf_bus_get_memdump result for error

From: Rafał Miłecki <[email protected]>

This method may be unsupported (see: USB bus) or may just fail (see:
SDIO bus).
While at it rework logic in brcmf_sdio_bus_get_memdump function to avoid too many conditional code nesting levels.

---
 .../wireless/broadcom/brcm80211/brcmfmac/debug.c   | 23 +++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c +16 -7
index e64557c35553..6f8a4b074c31 100644
@@ -32,16 +32,25 @@ static int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
 {
 	void *dump;
 	size_t ramsize;
+	int err;
 
 	ramsize = brcmf_bus_get_ramsize(bus);
-	if (ramsize) {
-		dump = vzalloc(len + ramsize);
-		if (!dump)
-			return -ENOMEM;
-		memcpy(dump, data, len);
-		brcmf_bus_get_memdump(bus, dump + len, ramsize);
-		dev_coredumpv(bus->dev, dump, len + ramsize, GFP_KERNEL);
+	if (!ramsize)
+		return -ENOTSUPP;
+
+	dump = vzalloc(len + ramsize);
+	if (!dump)
+		return -ENOMEM;
+
+	memcpy(dump, data, len);
+	err = brcmf_bus_get_memdump(bus, dump + len, ramsize);
+	if (err) {
+		vfree(dump);
+		return err;
 	}
+
+	dev_coredumpv(bus->dev, dump, len + ramsize, GFP_KERNEL);
+
 	return 0;
 }
 
Signature · 1 line
2.11.0
maintainer Acked-by on v1 1/2
#3 lore raw
Quoted 6 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

This method may be unsupported (see: USB bus) or may just fail (see:
SDIO bus).
While at it rework logic in brcmf_sdio_bus_get_memdump function to avoid too many conditional code nesting levels.

Quoted 43 lines
---
 .../wireless/broadcom/brcm80211/brcmfmac/debug.c   | 23 +++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c +16 -7
index e64557c35553..6f8a4b074c31 100644
@@ -32,16 +32,25 @@ static int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data,
 {
 	void *dump;
 	size_t ramsize;
+	int err;
 
 	ramsize = brcmf_bus_get_ramsize(bus);
-	if (ramsize) {
-		dump = vzalloc(len + ramsize);
-		if (!dump)
-			return -ENOMEM;
-		memcpy(dump, data, len);
-		brcmf_bus_get_memdump(bus, dump + len, ramsize);
-		dev_coredumpv(bus->dev, dump, len + ramsize, GFP_KERNEL);
+	if (!ramsize)
+		return -ENOTSUPP;
+
+	dump = vzalloc(len + ramsize);
+	if (!dump)
+		return -ENOMEM;
+
+	memcpy(dump, data, len);
+	err = brcmf_bus_get_memdump(bus, dump + len, ramsize);
+	if (err) {
+		vfree(dump);
+		return err;
 	}
+
+	dev_coredumpv(bus->dev, dump, len + ramsize, GFP_KERNEL);
+
 	return 0;
 }
 
maintainer Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] brcmfmac: be more verbose when PSM's watchdog fires

In reply to Rafał Miłecki
Quoted 4 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

It's important to inform user so he knows things went wrong. He may also want to get memory dump for further debugging purposes.

Quoted 31 lines
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c +10 -2
index 6f8a4b074c31..f4644cf371c7 100644
@@ -58,10 +58,18 @@ static int brcmf_debug_psm_watchdog_notify(struct brcmf_if *ifp,
 					   const struct brcmf_event_msg *evtmsg,
 					   void *data)
 {
+	int err;
+
 	brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx);
 
-	return brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
-					  evtmsg->datalen);
+	brcmf_err("PSM's watchdog has fired!\n");
+
+	err = brcmf_debug_create_memdump(ifp->drvr->bus_if, data,
+					 evtmsg->datalen);
+	if (err)
+		brcmf_err("Failed to get memory dump, %d\n", err);
+
+	return err;
 }
 
 void brcmf_debugfs_init(void)
#4 lore raw
In reply to Rafał Miłecki
Quoted 9 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

This method may be unsupported (see: USB bus) or may just fail (see:
SDIO bus).
While at it rework logic in brcmf_sdio_bus_get_memdump function to avoid too many conditional code nesting levels.

2 patches applied to wireless-drivers-next.git, thanks.

f4737a62033d brcmfmac: check brcmf_bus_get_memdump result for error 36401cb7ffae brcmfmac: be more verbose when PSM's watchdog fires

Signature · 6 lines
https://patchwork.kernel.org/patch/9545583/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches