brcmfmac: check brcmf_bus_get_memdump result for error
PATCH 2/2 brcmfmac: be more verbose when PSM's watchdog fires
In reply to Rafał MiłeckiFrom: 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
@@ -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
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
@@ -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
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 inbrcmf_sdio_bus_get_memdumpfunction to avoid too many conditional code nesting levels.
Quoted 43 lines
Signed-off-by Rafał Miłecki <[email protected]>--- .../wireless/broadcom/brcm80211/brcmfmac/debug.c | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c +16
-7@@ -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 ; }
Re: [PATCH 2/2] brcmfmac: be more verbose when PSM's watchdog fires
In reply to Rafał MiłeckiQuoted 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
Signed-off-by Rafał Miłecki <[email protected]>--- 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@@ -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 )
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 inbrcmf_sdio_bus_get_memdumpfunction to avoid too many conditional code nesting levels.Signed-off-by Rafał Miłecki <[email protected]>Acked-by Arend van Spriel <[email protected]>
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