Skip to contentSkip to conversation

gpio: virtuser: check the return value of gpiod_set_value()

PATCH Applied Bartosz Golaszewski 1 participant 2 messages Sep 22, 2025 – Oct 13, 2025 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: virtuser: check the return value of gpiod_set_value()

From: Bartosz Golaszewski <[email protected]>

We converted gpiod_set_value() and its variants to return an integer to indicate failures. Check the return value where it's ignored currently so that user-space agents controlling the virtual user module can get notified about errors.

---
 drivers/gpio/gpio-virtuser.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpio/gpio-virtuser.c +3 -5
index a10eab7d2617..37f2ce20f1ae 100644
@@ -500,9 +500,7 @@ static int gpio_virtuser_value_set(void *data, u64 val)
 	if (val > 1)
 		return -EINVAL;
 
-	gpiod_set_value_cansleep(ld->ad.desc, (int)val);
-
-	return 0;
+	return gpiod_set_value_cansleep(ld->ad.desc, (int)val);
 }
 
 DEFINE_DEBUGFS_ATTRIBUTE(gpio_virtuser_value_fops,
@@ -543,7 +541,7 @@ static void gpio_virtuser_set_value_atomic(struct irq_work *work)
 	struct gpio_virtuser_irq_work_context *ctx =
 			to_gpio_virtuser_irq_work_context(work);
 
-	gpiod_set_value(ctx->desc, ctx->val);
+	ctx->ret = gpiod_set_value(ctx->desc, ctx->val);
 	complete(&ctx->work_completion);
 }
 
@@ -562,7 +560,7 @@ static int gpio_virtuser_value_atomic_set(void *data, u64 val)
 
 	gpio_virtuser_irq_work_queue_sync(&ctx);
 
-	return 0;
+	return ctx.ret;
 }
 
 DEFINE_DEBUGFS_ATTRIBUTE(gpio_virtuser_value_atomic_fops,
Signature · 1 line
2.48.1
author Applied
#1 lore raw

From: Bartosz Golaszewski <[email protected]>

Quoted 6 lines · Bartosz Golaszewski

We converted gpiod_set_value() and its variants to return an integer to indicate failures. Check the return value where it's ignored currently so that user-space agents controlling the virtual user module can get notified about errors.

Applied, thanks!

[1/1] gpio: virtuser: check the return value of gpiod_set_value()

      https://git.kernel.org/brgl/linux/c/383760e3faa4d3df6e399d207e2930a785380c4e

Best regards,

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