Commit f4737a62 authored by Rafał Miłecki's avatar Rafał Miłecki Committed by Kalle Valo

brcmfmac: check brcmf_bus_get_memdump result for error

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: default avatarRafał Miłecki <rafal@milecki.pl>
Acked-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 62e13097
......@@ -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) {
if (!ramsize)
return -ENOTSUPP;
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);
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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment