gpio: virtuser: check the return value of gpiod_set_value()
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.
Signed-off-by Bartosz Golaszewski <[email protected]>
--- drivers/gpio/gpio-virtuser.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpio/gpio-virtuser.c +3 -5
@@ -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
Bartosz Golaszewski
AppliedFrom: 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]>