]> git.baikalelectronics.ru Git - kernel.git/commitdiff
wifi: brcmfmac: use strreplace() in brcmf_of_probe()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 16 Jun 2022 07:54:24 +0000 (10:54 +0300)
committerKalle Valo <kvalo@kernel.org>
Thu, 28 Jul 2022 09:55:51 +0000 (12:55 +0300)
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>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/YqrhsKcjEA7B2pC4@kili
drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c

index 083ac58f466d2f560858de258822663f7793eccf..811bd55f0d62da4820aa064805e34885c667b88a 100644 (file)
@@ -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);