Skip to contentSkip to conversation

gpio: virtuser: actually use the "trimmed" local variable

PATCH Applied Bartosz Golaszewski 1 participant 2 messages Jul 9, 2024 – Jul 10, 2024 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: virtuser: actually use the "trimmed" local variable

From: Bartosz Golaszewski <[email protected]>

This variable is set with the intention of being passed to the subsequent strcmp() but something went wrong and it was left unused. Use it now.

Fixes 91581c4b3f29 ("gpio: virtuser: new virtual testing driver for the GPIO API")
---
 drivers/gpio/gpio-virtuser.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpio-virtuser.c +3 -3
index 2ac09c6a3763..0e0d55da4f01 100644
@@ -406,12 +406,12 @@ static ssize_t gpio_virtuser_direction_do_write(struct file *file,
 
 	trimmed = strim(buf);
 
-	if (strcmp(buf, "input") == 0) {
+	if (strcmp(trimmed, "input") == 0) {
 		dir = 1;
-	} else if (strcmp(buf, "output-high") == 0) {
+	} else if (strcmp(trimmed, "output-high") == 0) {
 		dir = 0;
 		val = 1;
-	} else if (strcmp(buf, "output-low") == 0) {
+	} else if (strcmp(trimmed, "output-low") == 0) {
 		dir = val = 0;
 	} else {
 		return -EINVAL;
Signature · 1 line
2.43.0
author Applied
#1 lore raw

From: Bartosz Golaszewski <[email protected]>

Quoted 5 lines · Bartosz Golaszewski

This variable is set with the intention of being passed to the subsequent strcmp() but something went wrong and it was left unused. Use it now.

Applied, thanks!

[1/1] gpio: virtuser: actually use the "trimmed" local variable

      commit: 1d8267bcbb7aa2176365299ad57e067f73b5174d

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>