Bluetooth: btbcm: Use strreplace() in btbcm_get_board_name()
Subsystems (2)
PATCH 1/1 Bluetooth: btbcm: Use strreplace() in btbcm_get_board_name()
The original code works but it's a bit iffy. The end of loop test should be something like "board_type[i] != '\0'" but instead it is is "i < board_type[i]". Fortunately, those two tests are equivalent so long as the "board_type" is not an empty string.
It's much simpler to just call strreplace() instead.
--- drivers/bluetooth/btbcm.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/bluetooth/btbcm.c +1 -5
@@ -498,7 +498,6 @@ static const char *btbcm_get_board_name(struct device *dev)char *board_type;const char *tmp;int len; -int i; root =of_find_node_by_path ("/" );if (!root)
@@ -511,10 +510,7 @@ static const char *btbcm_get_board_name(struct device *dev) len =strlen (tmp) +1 ; board_type =devm_kzalloc (dev, len,GFP_KERNEL );strscpy (board_type, tmp, len); -for (i =0 ; i < board_type[i]; i++) { -if (board_type[i] =='/' ) - board_type[i] ='-' ; - } +strreplace (board_type,'/' ,'-' );of_node_put (root);return board_type;
Signature · 1 line
2.35.1
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=650472
---Test result---
Test Summary:
CheckPatch PASS 0.81 seconds GitLint PASS 0.44 seconds SubjectPrefix PASS 0.31 seconds BuildKernel PASS 36.37 seconds BuildKernel32 PASS 31.72 seconds Incremental Build with patchesPASS 42.70 seconds TestRunner: Setup PASS 537.98 seconds TestRunner: l2cap-tester PASS 18.31 seconds TestRunner: bnep-tester PASS 7.34 seconds TestRunner: mgmt-tester PASS 115.33 seconds TestRunner: rfcomm-tester PASS 10.62 seconds TestRunner: sco-tester PASS 10.46 seconds TestRunner: smp-tester PASS 10.58 seconds TestRunner: userchan-tester PASS 7.04 seconds
---
Regards,
Linux Bluetooth
Quoted 8 lines · Dan Carpenter
The original code works but it's a bit iffy. The end of loop test should be something like "board_type[i] != '\0'" but instead it is is "i < board_type[i]". Fortunately, those two tests are equivalent so long as the "
board_type" is not an empty string.It's much simpler to just call
strreplace()instead.Signed-off-by Dan Carpenter <[email protected]>
I think I just copied this code from the BRCM wifi driver for the combo chip, did you patch that too?
Yours,
Linus Walleij
Quoted 7 lines · Linus Walleij
Quoted 5 lines · Dan Carpenter
The original code works but it's a bit iffy. The end of loop test should be something like "board_type[i] != '\0'" but instead it is is "i < board_type[i]". Fortunately, those two tests are equivalent so long as the "
board_type" is not an empty string.
Quoted 8 lines
Quoted 3 lines
It's much simpler to just call
strreplace()instead.Signed-off-by Dan Carpenter <[email protected]>Reviewed-by Linus Walleij <[email protected]>I think I just copied this code from the BRCM wifi driver for the combo chip, did you patch that too?
Uh, I did but it got lost (my fault). I will resend that. Thanks!
regards,
dan carpenter