Skip to content

Commit 58b1569

Browse files
Villemoesdlezcano
authored andcommitted
thermal/drivers/armada: Simplify name sanitization
Simplify the code by using the helper we have for doing exactly this. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20240320104940.65031-1-linux@rasmusvillemoes.dk
1 parent d9d3490 commit 58b1569

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

drivers/thermal/armada_thermal.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,6 @@ static void armada_set_sane_name(struct platform_device *pdev,
763763
struct armada_thermal_priv *priv)
764764
{
765765
const char *name = dev_name(&pdev->dev);
766-
char *insane_char;
767766

768767
if (strlen(name) > THERMAL_NAME_LENGTH) {
769768
/*
@@ -781,12 +780,8 @@ static void armada_set_sane_name(struct platform_device *pdev,
781780
/* Save the name locally */
782781
strscpy(priv->zone_name, name, THERMAL_NAME_LENGTH);
783782

784-
/* Then check there are no '-' or hwmon core will complain */
785-
do {
786-
insane_char = strpbrk(priv->zone_name, "-");
787-
if (insane_char)
788-
*insane_char = '_';
789-
} while (insane_char);
783+
/* Then ensure there are no '-' or hwmon core will complain */
784+
strreplace(priv->zone_name, '-', '_');
790785
}
791786

792787
/*

0 commit comments

Comments
 (0)