int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, size_t len) { void *dump; size_t ramsize; int err; ramsize = brcmf_bus_get_ramsize(bus); if (!ramsize) return -ENOTSUPP; dump = vzalloc(len + ramsize); if (!dump) return -ENOMEM; if (data && len > 0) 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; }
static int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, size_t len) { void *dump; size_t ramsize; 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); } return 0; }