* [PATCH] iio: Fix return value check for set_trigger_state()
@ 2023-07-13 10:47 Waqar Hameed
2023-07-15 17:29 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Waqar Hameed @ 2023-07-13 10:47 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen; +Cc: kernel, linux-iio, linux-kernel
In `iio_trigger_detach_poll_func()` the return value from
`trig->ops->set_trigger_state(trig, false)` is checked with `if (ret)`.
However, in `iio_trigger_attach_poll_func()` it is checked with
`if (ret < 0)`. Fix this mismatch by only checking for `if (ret)` in
both places.
Signed-off-by: Waqar Hameed <waqar.hameed@axis.com>
---
drivers/iio/industrialio-trigger.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
index f207e36b12cc..18f83158f637 100644
--- a/drivers/iio/industrialio-trigger.c
+++ b/drivers/iio/industrialio-trigger.c
@@ -313,7 +313,7 @@ int iio_trigger_attach_poll_func(struct iio_trigger *trig,
/* Enable trigger in driver */
if (trig->ops && trig->ops->set_trigger_state && notinuse) {
ret = trig->ops->set_trigger_state(trig, true);
- if (ret < 0)
+ if (ret)
goto out_free_irq;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: Fix return value check for set_trigger_state()
2023-07-13 10:47 [PATCH] iio: Fix return value check for set_trigger_state() Waqar Hameed
@ 2023-07-15 17:29 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2023-07-15 17:29 UTC (permalink / raw)
To: Waqar Hameed; +Cc: Lars-Peter Clausen, kernel, linux-iio, linux-kernel
On Thu, 13 Jul 2023 12:47:31 +0200
Waqar Hameed <waqar.hameed@axis.com> wrote:
> In `iio_trigger_detach_poll_func()` the return value from
> `trig->ops->set_trigger_state(trig, false)` is checked with `if (ret)`.
> However, in `iio_trigger_attach_poll_func()` it is checked with
> `if (ret < 0)`. Fix this mismatch by only checking for `if (ret)` in
> both places.
I wouldn't have used fix in the title unless you have a case where this
causes problems (so a driver returns > 0 for this callback).
I have no problem with it as a consistency improvement but I don't
really want to see it backported (which will happen with fix in the
title ;)
I'll tweak that and with that done, applied to the togreg branch
of iio.git and pushed out initially as testing to let 0-day see if
it can find anything we missed.
Thanks,
Jonathan
>
> Signed-off-by: Waqar Hameed <waqar.hameed@axis.com>
> ---
> drivers/iio/industrialio-trigger.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
> index f207e36b12cc..18f83158f637 100644
> --- a/drivers/iio/industrialio-trigger.c
> +++ b/drivers/iio/industrialio-trigger.c
> @@ -313,7 +313,7 @@ int iio_trigger_attach_poll_func(struct iio_trigger *trig,
> /* Enable trigger in driver */
> if (trig->ops && trig->ops->set_trigger_state && notinuse) {
> ret = trig->ops->set_trigger_state(trig, true);
> - if (ret < 0)
> + if (ret)
> goto out_free_irq;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-15 17:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-13 10:47 [PATCH] iio: Fix return value check for set_trigger_state() Waqar Hameed
2023-07-15 17:29 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).