From: David Lechner <dlechner@baylibre.com>
To: kernel test robot <lkp@intel.com>,
Andrew Ijano <andrew.ijano@gmail.com>,
jic23@kernel.org
Cc: oe-kbuild-all@lists.linux.dev, andrew.lopes@alumni.usp.br,
gustavobastos@usp.br, nuno.sa@analog.com, andy@kernel.org,
jstephan@baylibre.com, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 3/3] iio: accel: sca3000: use guard(mutex)() for handling mutex lock
Date: Thu, 12 Jun 2025 11:06:16 -0500 [thread overview]
Message-ID: <1c1c2888-be50-4578-8afd-bfbe4bd9cbae@baylibre.com> (raw)
In-Reply-To: <202506122309.FvJPaMhh-lkp@intel.com>
On 6/12/25 10:52 AM, kernel test robot wrote:
> Hi Andrew,
>
> kernel test robot noticed the following build errors:
>
> [auto build test ERROR on jic23-iio/togreg]
> [also build test ERROR on linus/master v6.16-rc1 next-20250612]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Andrew-Ijano/iio-accel-sca3000-replace-error_ret-labels-by-simple-returns/20250612-034940
> base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
> patch link: https://lore.kernel.org/r/20250611194648.18133-4-andrew.lopes%40alumni.usp.br
> patch subject: [PATCH v5 3/3] iio: accel: sca3000: use guard(mutex)() for handling mutex lock
> config: nios2-randconfig-002-20250612 (https://download.01.org/0day-ci/archive/20250612/202506122309.FvJPaMhh-lkp@intel.com/config)
> compiler: nios2-linux-gcc (GCC) 8.5.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250612/202506122309.FvJPaMhh-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202506122309.FvJPaMhh-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
> In file included from include/linux/irqflags.h:17,
> from include/asm-generic/bitops.h:14,
> from ./arch/nios2/include/generated/asm/bitops.h:1,
> from include/linux/bitops.h:68,
> from include/linux/kernel.h:23,
> from include/linux/interrupt.h:6,
> from drivers/iio/accel/sca3000.c:10:
> drivers/iio/accel/sca3000.c: In function 'sca3000_read_raw':
>>> include/linux/cleanup.h:258:2: error: a label can only be part of a statement and a declaration is not a statement
> class_##_name##_t var __cleanup(class_##_name##_destructor) = \
> ^~~~~~
> include/linux/cleanup.h:319:2: note: in expansion of macro 'CLASS'
> CLASS(_name, __UNIQUE_ID(guard))
> ^~~~~
> drivers/iio/accel/sca3000.c:699:3: note: in expansion of macro 'guard'
> guard(mutex)(&st->lock);
> ^~~~~
>>> include/linux/cleanup.h:258:2: error: a label can only be part of a statement and a declaration is not a statement
> class_##_name##_t var __cleanup(class_##_name##_destructor) = \
> ^~~~~~
> include/linux/cleanup.h:319:2: note: in expansion of macro 'CLASS'
> CLASS(_name, __UNIQUE_ID(guard))
> ^~~~~
> drivers/iio/accel/sca3000.c:731:3: note: in expansion of macro 'guard'
> guard(mutex)(&st->lock);
> ^~~~~
>>> include/linux/cleanup.h:258:2: error: a label can only be part of a statement and a declaration is not a statement
> class_##_name##_t var __cleanup(class_##_name##_destructor) = \
> ^~~~~~
> include/linux/cleanup.h:319:2: note: in expansion of macro 'CLASS'
> CLASS(_name, __UNIQUE_ID(guard))
> ^~~~~
> drivers/iio/accel/sca3000.c:735:3: note: in expansion of macro 'guard'
> guard(mutex)(&st->lock);
> ^~~~~
> drivers/iio/accel/sca3000.c: In function 'sca3000_write_raw':
> drivers/iio/accel/sca3000.c:748:6: warning: unused variable 'ret' [-Wunused-variable]
> int ret;
> ^~~
> In file included from include/linux/irqflags.h:17,
> from include/asm-generic/bitops.h:14,
> from ./arch/nios2/include/generated/asm/bitops.h:1,
> from include/linux/bitops.h:68,
> from include/linux/kernel.h:23,
> from include/linux/interrupt.h:6,
> from drivers/iio/accel/sca3000.c:10:
> drivers/iio/accel/sca3000.c: In function 'sca3000_read_event_value':
>>> include/linux/cleanup.h:258:2: error: a label can only be part of a statement and a declaration is not a statement
> class_##_name##_t var __cleanup(class_##_name##_destructor) = \
> ^~~~~~
> include/linux/cleanup.h:319:2: note: in expansion of macro 'CLASS'
> CLASS(_name, __UNIQUE_ID(guard))
> ^~~~~
> drivers/iio/accel/sca3000.c:835:3: note: in expansion of macro 'guard'
> guard(mutex)(&st->lock);
> ^~~~~
> drivers/iio/accel/sca3000.c: In function 'sca3000_write_event_value':
> drivers/iio/accel/sca3000.c:881:6: warning: unused variable 'ret' [-Wunused-variable]
> int ret;
> ^~~
> drivers/iio/accel/sca3000.c: In function 'sca3000_write_event_config':
> drivers/iio/accel/sca3000.c:1188:6: warning: unused variable 'ret' [-Wunused-variable]
> int ret;
> ^~~
>
>
> vim +258 include/linux/cleanup.h
>
> 54da6a0924311c Peter Zijlstra 2023-05-26 256
> 54da6a0924311c Peter Zijlstra 2023-05-26 257 #define CLASS(_name, var) \
> 54da6a0924311c Peter Zijlstra 2023-05-26 @258 class_##_name##_t var __cleanup(class_##_name##_destructor) = \
> 54da6a0924311c Peter Zijlstra 2023-05-26 259 class_##_name##_constructor
> 54da6a0924311c Peter Zijlstra 2023-05-26 260
> 54da6a0924311c Peter Zijlstra 2023-05-26 261
>
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;
}
next prev parent reply other threads:[~2025-06-12 16:06 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-11 19:39 [PATCH v5 0/3] iio: accel: sca3000: simplify by using newer infrastructure Andrew Ijano
2025-06-11 19:39 ` [PATCH v5 1/3] iio: accel: sca3000: replace error_ret labels by simple returns Andrew Ijano
2025-06-12 6:20 ` Nuno Sá
2025-06-12 6:41 ` Nuno Sá
2025-06-14 19:12 ` Andrew Ijano
2025-06-12 12:56 ` Andy Shevchenko
2025-06-14 11:48 ` Jonathan Cameron
2025-06-14 19:16 ` Andrew Ijano
2025-06-11 19:39 ` [PATCH v5 2/3] iio: accel: sca3000: replace usages of internal read data helpers by spi helpers Andrew Ijano
2025-06-12 6:29 ` Nuno Sá
2025-06-14 19:33 ` Andrew Ijano
2025-06-18 2:36 ` Andrew Ijano
2025-06-12 13:22 ` Andy Shevchenko
2025-06-14 21:06 ` Andrew Ijano
2025-06-14 21:50 ` Andy Shevchenko
2025-06-15 3:21 ` Andrew Ijano
2025-06-11 19:39 ` [PATCH v5 3/3] iio: accel: sca3000: use guard(mutex)() for handling mutex lock Andrew Ijano
2025-06-12 6:38 ` Nuno Sá
2025-06-14 11:54 ` Jonathan Cameron
2025-06-14 21:17 ` Andrew Ijano
2025-06-12 14:48 ` kernel test robot
2025-06-12 15:52 ` kernel test robot
2025-06-12 16:06 ` David Lechner [this message]
2025-06-14 21:21 ` Andrew Ijano
2025-06-14 12:01 ` Jonathan Cameron
2025-06-14 21:40 ` Andrew Ijano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1c1c2888-be50-4578-8afd-bfbe4bd9cbae@baylibre.com \
--to=dlechner@baylibre.com \
--cc=andrew.ijano@gmail.com \
--cc=andrew.lopes@alumni.usp.br \
--cc=andy@kernel.org \
--cc=gustavobastos@usp.br \
--cc=jic23@kernel.org \
--cc=jstephan@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=nuno.sa@analog.com \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.