From: Dan Carpenter Date: Thu, 16 Jun 2022 07:54:24 +0000 (+0300) Subject: wifi: brcmfmac: use strreplace() in brcmf_of_probe() X-Git-Tag: v6.0-rc1~141^2~23^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bef11f1edc40cee156c60f9dbbbd9725a56b3639;p=thirdparty%2Fkernel%2Flinux.git wifi: brcmfmac: use strreplace() in brcmf_of_probe() 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 Suggested-by: Johannes Berg Reviewed-by: Linus Walleij Acked-by: Arend van Spriel Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/YqrhsKcjEA7B2pC4@kili --- diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c index 083ac58f466d2..811bd55f0d62d 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);