From: Dan Carpenter <dan.carpenter@oracle.com>
To: Arend van Spriel <aspriel@gmail.com>,
Johannes Berg <johannes@sipsolutions.net>
Cc: Franky Lin <franky.lin@broadcom.com>,
Hante Meuleman <hante.meuleman@broadcom.com>,
Kalle Valo <kvalo@kernel.org>, Len Baker <len.baker@gmx.com>,
Shawn Guo <shawn.guo@linaro.org>,
Hector Martin <marcan@marcan.st>,
linux-wireless@vger.kernel.org,
brcm80211-dev-list.pdl@broadcom.com,
Linus Walleij <linus.walleij@linaro.org>,
kernel-janitors@vger.kernel.org
Subject: [PATCH] brcmfmac: use strreplace() in brcmf_of_probe()
Date: Thu, 16 Jun 2022 10:54:24 +0300 [thread overview]
Message-ID: <YqrhsKcjEA7B2pC4@kili> (raw)
The for loop in brcmf_of_probe() would ideally end with something like
"i <= strlen(board_type)" instead of "i < board_type[i]". But
fortunately, the two are equivalent.
Anyway, it's simpler to use strreplace() instead.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Johannes Berg <johannes@sipsolutions.net>
---
I sent something like this last year but I did something wrong and it
never made it patchwork. This is basically a new patch.
drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
index 083ac58f466d..811bd55f0d62 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
@@ -72,7 +72,6 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
/* Set board-type to the first string of the machine compatible prop */
root = of_find_node_by_path("/");
if (root) {
- int i;
char *board_type;
const char *tmp;
@@ -84,10 +83,7 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
of_node_put(root);
return;
}
- for (i = 0; i < board_type[i]; i++) {
- if (board_type[i] == '/')
- board_type[i] = '-';
- }
+ strreplace(board_type, '/', '-');
settings->board_type = board_type;
of_node_put(root);
--
2.35.1
next reply other threads:[~2022-06-16 7:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-16 7:54 Dan Carpenter [this message]
2022-06-16 13:08 ` [PATCH] brcmfmac: use strreplace() in brcmf_of_probe() Linus Walleij
2022-06-17 15:14 ` Arend van Spriel
2022-07-28 9:55 ` wifi: " Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YqrhsKcjEA7B2pC4@kili \
--to=dan.carpenter@oracle.com \
--cc=aspriel@gmail.com \
--cc=brcm80211-dev-list.pdl@broadcom.com \
--cc=franky.lin@broadcom.com \
--cc=hante.meuleman@broadcom.com \
--cc=johannes@sipsolutions.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=kvalo@kernel.org \
--cc=len.baker@gmx.com \
--cc=linus.walleij@linaro.org \
--cc=linux-wireless@vger.kernel.org \
--cc=marcan@marcan.st \
--cc=shawn.guo@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox