Re: [PATCH v2 4/4] iio: magnetometer: rm3100: Use guard(mutex)() in rm3100_trigger_handler()

From: Maxwell Doose

Date: Tue Apr 28 2026 - 14:19:09 EST


On Tue, Apr 28, 2026 at 10:32 AM Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
>
> Read the guidance in cleanup.h It's pretty clear that nothing from
> that file should ever be used in functions that use gotos.
>
> Whilst there might not be a bug here, it ends up being fragile
> as people changing the code may not noticed that can't use an existing
> label and hence jump the hidden __free() in that guard() call.
>

Then I guess if we really want to do this then we should probably get
rid of the gotos? Because I can certainly do that. Either that or we
just keep the manual locks and unlocks.

> Be careful to ensure any expanded scope only contains calls where you can
> easily see they don't deadlock or do anything time consuming.

I'll also double-check that.

best regards,
maxwell