diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2024-02-17 10:30:42 +0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2024-03-07 01:24:06 +0300 |
commit | f9183eaad91521ba1c04a19e5606ae61560a735e (patch) | |
tree | 820683613b3e83b6830f5f190820dc4c7f9698c2 | |
parent | e49f18b92bd1023407281e7f60b7010c12edc3b1 (diff) | |
download | linux-f9183eaad91521ba1c04a19e5606ae61560a735e.tar.xz |
Bluetooth: btbcm: Use devm_kstrdup()
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>
-rw-r--r-- | drivers/bluetooth/btbcm.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index 01d2343b4978..f9a7c790d7e2 100644 --- a/drivers/bluetooth/btbcm.c +++ b/drivers/bluetooth/btbcm.c @@ -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) @@ -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); |