Re: [PATCH v3 1/2] iio: light: gp2ap020a00f: simplify locking with guard()

From: Ethan Tidmore

Date: Tue Feb 17 2026 - 04:03:30 EST


On Tue Feb 17, 2026 at 2:37 AM CST, Andy Shevchenko wrote:
> On Mon, Feb 16, 2026 at 03:04:55PM -0600, Ethan Tidmore wrote:
>> On Mon Feb 16, 2026 at 1:08 AM CST, Andy Shevchenko wrote:
>> > On Sun, Feb 15, 2026 at 06:53:16PM -0600, Ethan Tidmore wrote:
>
> ...
>
>> >> int i, err = 0;
>> >
>> > Would you need the err assignment now?
>>
>> I'm not familiar with iio_for_each_active_channel() but, if there's a
>> chance it could run zero times, then it'd run into if (err) with err
>> not being initialized?
>
> Have you read my other comments? I also mentioned to replace
>
> err = -ENOMEM;
>
> with
>
> return -ENOMEM;

Sorry about that, when you asked about the assignment, I thought you meant
the initialization (err = 0) vs just declaring it (int err), rather than
realizing the variable itself is redundant. Will send v4 shortly.

Thanks,

ET