Message ID | 20170130150952.7133-1-zajec5@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | f4737a62033d7f3e0db740c449fc62119da7ab8a |
Delegated to: | Kalle Valo |
Headers | show |
On 30-1-2017 16:09, Rafał Miłecki wrote: > From: Rafał Miłecki <rafal@milecki.pl> > > 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. Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com> > Signed-off-by: Rafał Miłecki <rafal@milecki.pl> > --- > .../wireless/broadcom/brcm80211/brcmfmac/debug.c | 23 +++++++++++++++------- > 1 file changed, 16 insertions(+), 7 deletions(-) > > diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c > index e64557c35553..6f8a4b074c31 100644 > --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c > +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c > @@ -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; > } > >
Rafał Miłecki wrote: > From: Rafał Miłecki <rafal@milecki.pl> > > 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. > > Signed-off-by: Rafał Miłecki <rafal@milecki.pl> > Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com> 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
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c index e64557c35553..6f8a4b074c31 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c @@ -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; }