[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANZih_TWMx2d=8FGRLdHdvQDRQxoYar0v+YpeiogdQOWTnLHpQ@mail.gmail.com>
Date: Sat, 14 Jun 2025 18:21:34 -0300
From: Andrew Ijano <andrew.ijano@...il.com>
To: David Lechner <dlechner@...libre.com>
Cc: kernel test robot <lkp@...el.com>, jic23@...nel.org, oe-kbuild-all@...ts.linux.dev,
andrew.lopes@...mni.usp.br, gustavobastos@....br, nuno.sa@...log.com,
andy@...nel.org, jstephan@...libre.com, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 3/3] iio: accel: sca3000: use guard(mutex)() for
handling mutex lock
On Thu, Jun 12, 2025 at 1:06 PM David Lechner <dlechner@...libre.com> wrote:
>
> On 6/12/25 10:52 AM, kernel test robot wrote:
> > Hi Andrew,
...
>
> These error messages aren't particularity helpful, but what I think
> this is try to say is that you have to be careful with guard() in
> switch statements.
>
> The guard() macro is declaring a new local variable, which shouldn't
> be done in a case: statement without enclosing it in a separate scope.
> Some compilers complain and some don't so even if it worked for you
> locally, we need to make it work for all supported compilers.
>
> So the code needs to looks something like this:
>
> case IIO_CHAN_INFO_SAMP_FREQ: {
> guard(mutex)(&st->lock);
> ret = sca3000_read_raw_samp_freq(st, val);
> return ret ? ret : IIO_VAL_INT;
> }
Hi, David! Thanks a lot for the explanation. I'll make this change right away.
Thanks,
Andrew
Powered by blists - more mailing lists