Skip to content

Commit

Permalink
wifi: brcmsmac: Use kvmemdup to simplify the code
Browse files Browse the repository at this point in the history
Use kvmemdup instead of kvmalloc() + memcpy() to simplify the code.

No functional change.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/20240821070257.2298559-1-ruanjinjie@huawei.com
  • Loading branch information
Jinjie Ruan authored and Kalle Valo committed Sep 3, 2024
1 parent 25f8554 commit d387922
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1611,18 +1611,16 @@ int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf, u32 idx)
if (le32_to_cpu(hdr->idx) == idx) {
pdata = wl->fw.fw_bin[i]->data +
le32_to_cpu(hdr->offset);
*pbuf = kvmalloc(len, GFP_KERNEL);
*pbuf = kvmemdup(pdata, len, GFP_KERNEL);
if (*pbuf == NULL)
goto fail;
memcpy(*pbuf, pdata, len);
return -ENOMEM;
return 0;
}
}
}
brcms_err(wl->wlc->hw->d11core,
"ERROR: ucode buf tag:%d can not be found!\n", idx);
*pbuf = NULL;
fail:
return -ENODATA;
}

Expand Down

0 comments on commit d387922

Please sign in to comment.