Re: [PATCH] iio: trigger: Remove redundant conditionals
From: Gyeyoung Baek
Date: Mon May 05 2025 - 04:29:51 EST
On Sun, May 4, 2025 at 11:30 PM Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
>
> On Sun, 4 May 2025 03:56:50 +0900
> Gyeyoung Baek <gye976@xxxxxxxxx> wrote:
>
> > Checks for null initially and return early.
> > So there is no need to check for null later.
> >
> > Signed-off-by: Gyeyoung Baek <gye976@xxxxxxxxx>
>
> So the key thing here is what does this path mean. trig == NULL
> means we are clearing the current trigger. The snag is you just jumped
> over the code that removes the old trigger or sets
> indio_dev->trig = NULL.
>
> So I think the new version you have here is broken.
>
> For changes like this it is fairly easy to test them using the
> dummy driver. Please make sure to do so and make sure you trigger
> all paths. Here that would be.
>
> No trigger -> trigger 1
> trigger 1 -> trigger 2
> trigger 2 -> no trigger
>
Apologies, I misunderstood the logic.
I’ll make sure to verify it thoroughly before sending a patch.
Thanks for the review.
--
Regards,
Gyeyoung