Commit 9cf6d7f2 authored by Hector Martin's avatar Hector Martin Committed by Kalle Valo

brcmfmac: of: Use devm_kstrdup for board_type & check for errors

This was missing a NULL check, and we can collapse the strlen/alloc/copy
into a devm_kstrdup().
Reviewed-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarHector Martin <marcan@marcan.st>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220131160713.245637-8-marcan@marcan.st
parent b50255c8
......@@ -79,8 +79,11 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
/* get rid of '/' in the compatible string to be able to find the FW */
len = strlen(tmp) + 1;
board_type = devm_kzalloc(dev, len, GFP_KERNEL);
strscpy(board_type, tmp, len);
board_type = devm_kstrdup(dev, tmp, GFP_KERNEL);
if (!board_type) {
of_node_put(root);
return;
}
for (i = 0; i < board_type[i]; i++) {
if (board_type[i] == '/')
board_type[i] = '-';
......
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