pinctrl: devicetree: Use strlen() instead of hardcoded number
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 31 Jul 2019 13:29:15 +0000 (15:29 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 5 Aug 2019 11:29:29 +0000 (13:29 +0200)
Improve readability by replacing a hardcoded number requiring a comment
by strlen().

Gcc is smart enough to evaluate the length of a constant string at
compile-time.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20190731132917.17607-2-geert+renesas@glider.be
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/devicetree.c

index 88ddbb2e30de10f671cc3d6c144914ee475351be..5d6d8b1e906203af159d336c2a2065b2ef57cd22 100644 (file)
@@ -228,10 +228,8 @@ int pinctrl_dt_to_map(struct pinctrl *p, struct pinctrl_dev *pctldev)
                 * than dynamically allocate it and have to free it later,
                 * just point part way into the property name for the string.
                 */
-               if (ret < 0) {
-                       /* strlen("pinctrl-") == 8 */
-                       statename = prop->name + 8;
-               }
+               if (ret < 0)
+                       statename = prop->name + strlen("pinctrl-");
 
                /* For every referenced pin configuration node in it */
                for (config = 0; config < size; config++) {