* [PATCH] Bluetooth: btbcm: Use strreplace() in btbcm_get_board_name()
@ 2022-06-15 8:26 Dan Carpenter
2022-06-15 9:11 ` bluez.test.bot
2022-06-15 21:50 ` [PATCH] " Linus Walleij
0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-06-15 8:26 UTC (permalink / raw)
To: Marcel Holtmann, Linus Walleij
Cc: Johan Hedberg, Luiz Augusto von Dentz, linux-bluetooth, kernel-janitors
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 <dan.carpenter@oracle.com>
---
drivers/bluetooth/btbcm.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c
index 3006e2a0f37e..bcf254e2b138 100644
--- a/drivers/bluetooth/btbcm.c
+++ b/drivers/bluetooth/btbcm.c
@@ -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;
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: Bluetooth: btbcm: Use strreplace() in btbcm_get_board_name()
2022-06-15 8:26 [PATCH] Bluetooth: btbcm: Use strreplace() in btbcm_get_board_name() Dan Carpenter
@ 2022-06-15 9:11 ` bluez.test.bot
2022-06-15 21:50 ` [PATCH] " Linus Walleij
1 sibling, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2022-06-15 9:11 UTC (permalink / raw)
To: linux-bluetooth, dan.carpenter
[-- Attachment #1: Type: text/plain, Size: 1100 bytes --]
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Bluetooth: btbcm: Use strreplace() in btbcm_get_board_name()
2022-06-15 8:26 [PATCH] Bluetooth: btbcm: Use strreplace() in btbcm_get_board_name() Dan Carpenter
2022-06-15 9:11 ` bluez.test.bot
@ 2022-06-15 21:50 ` Linus Walleij
2022-06-16 7:54 ` Dan Carpenter
1 sibling, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2022-06-15 21:50 UTC (permalink / raw)
To: Dan Carpenter
Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
linux-bluetooth, kernel-janitors
On Wed, Jun 15, 2022 at 10:26 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 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 <dan.carpenter@oracle.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
I think I just copied this code from the BRCM wifi driver for the combo
chip, did you patch that too?
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Bluetooth: btbcm: Use strreplace() in btbcm_get_board_name()
2022-06-15 21:50 ` [PATCH] " Linus Walleij
@ 2022-06-16 7:54 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2022-06-16 7:54 UTC (permalink / raw)
To: Linus Walleij
Cc: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
linux-bluetooth, kernel-janitors
On Wed, Jun 15, 2022 at 11:50:35PM +0200, Linus Walleij wrote:
> On Wed, Jun 15, 2022 at 10:26 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> > 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 <dan.carpenter@oracle.com>
>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-06-16 7:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15 8:26 [PATCH] Bluetooth: btbcm: Use strreplace() in btbcm_get_board_name() Dan Carpenter
2022-06-15 9:11 ` bluez.test.bot
2022-06-15 21:50 ` [PATCH] " Linus Walleij
2022-06-16 7:54 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).