Skip to content

Commit

Permalink
Bluetooth: btbcm: Use devm_kstrdup()
Browse files Browse the repository at this point in the history
Use devm_kstrdup() instead of hand-writing it.
It is less verbose.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
  • Loading branch information
Christophe JAILLET authored and Luiz Augusto von Dentz committed Mar 6, 2024
1 parent e49f18b commit f9183ea
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/bluetooth/btbcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,6 @@ static const char *btbcm_get_board_name(struct device *dev)
struct device_node *root;
char *board_type;
const char *tmp;
int len;

root = of_find_node_by_path("/");
if (!root)
Expand All @@ -554,9 +553,7 @@ static const char *btbcm_get_board_name(struct device *dev)
return NULL;

/* get rid of any '/' in the compatible string */
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);
strreplace(board_type, '/', '-');
of_node_put(root);

Expand Down

0 comments on commit f9183ea

Please sign in to comment.