From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D02F29A9E4 for ; Thu, 12 Jun 2025 16:06:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749744383; cv=none; b=XKadwb8OboQzOi2qcRr7058LoTvB51MQX5i9OP8c50EZo0QZXIUcvYD+DBVpI5trj32hZ+RGBg2WTFOY1HKQ2rF5lBcu0Lqj+GXtD4e0g7nzGRphmi9x7S5sSwlidOM305B70rD0ISRFru1Q36gtpakwdZg5JuDTwpFPG2L+f6Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749744383; c=relaxed/simple; bh=04GkUWrTTqQUp181YEIvcJyQTVFi48opIFB+InHSc5Y=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=PixowBHjH0L2gKS16tFWDU3dDxcvMqBd2VVDfjxXa1R4NyqX8opQ2EwdBwJX1MXjFVqlyvdo1AlPx2/2rrmRFV6CXPKS/EBCBNROR/owPKQRIpvXSbiIjy1QBrjxml3bj8cnbFmsmjw8RhtvhjtUd50SPOaghHDNTwJIEV9PAqE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=Re/3dRW2; arc=none smtp.client-ip=209.85.160.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="Re/3dRW2" Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-2ea34731c5dso572958fac.0 for ; Thu, 12 Jun 2025 09:06:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1749744378; x=1750349178; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=udm2JNtgUVnGtTALc+UG19LJaRFqXt9eusqJiG8Hlj0=; b=Re/3dRW2GO2T1linoO7pdxEfl+o7fEpuCbVNWWkd5ALiX7+bZEHN+0wYnXjYG0gH/8 LzTcsFGe3lf9+tJkFMOdtw+aJh+/m7FvZ9C/wssZ+UOyaQW4Z3pXVItVakdu05tkMIMD Es7pZ0QtrV/knk9Y7NTZRt1RG1o+9h+rJHSnN8Wf1QrCh76HJ/1oGs+bEblVJGRw+nvJ TjnlVm9nXofjXRf6LhVZX8BKEyHoxHjWjqULqGVsZmAyw1csSp3nXXEsHTw917ySO2rC 82jWsMxiU6OxcMaewmUpKWlxKA1qmIG+94TQ974lZFTyrEMpqbj1P9CKzaqzDnR8z8vD zYuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749744378; x=1750349178; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=udm2JNtgUVnGtTALc+UG19LJaRFqXt9eusqJiG8Hlj0=; b=XqbWfwk9aoiqclUQdEzBn1AM1vWHNvEXJVesSGyyaS+zv6CoVyghdTKrMOT+i0LTC6 5udKz6jrkxxDIiPGHqIIogocaNTrdw1rXQw21bn3yM6g8p/6CuuypXZahzrX3Sm/SRpB maHzaL3uRMfR4xAC3vvYHQZ625ox1N4dvC1ErqZixXv24QyixM550aqdZl9TbvNFT1V4 9zZcuUcpWNh9q4rgIm8/OKWhGgtqbrDIViP1fo99yF1s9KkVElN4GpUGJfbcoNIyUT1W R3gx/f7Ix+LDY02E5eHmgp3t0bq8uHr4SGt7DzaFcI6pRxz/mhssqsKh9noTr1U4QSyh n6kg== X-Forwarded-Encrypted: i=1; AJvYcCVop/KDem5h7tPuhD4yZrIH5rQCBTxXvZ1C7CWGAURthGVoYCMcknQl1IjEZVbuod4kLTaS+RaL+ykHAA0=@vger.kernel.org X-Gm-Message-State: AOJu0YzjkdptoyAiAnw7DdDaIxQyzZa7vuy/5pgRk7qi85EaL7Rw/ED9 JAkSha9uM0tLjd+irKTrf0gJ6XQxxul9pQdgupjJD5P71CuPmfvQtmb5xTUXGxSDtFw= X-Gm-Gg: ASbGncs0y94WzM30H8tOHeEMtcAhMQKm82Tf+wTApBO3af+pHAJWVJtusTqQecIc5YD tspyxOp+jtsDEgzlVRlIn8+fF3L2mmQ4QCjUGaJAReal3wZe1x8cvWNBxeHiTWgVeoI/FEEA9vN HHZU9g0BcIHn5Qk5bAgwLVJanYDFn49YO+t/oIKcpJeXrMg9dvfHi2p6Z2x0IbJD3XWdzFim5Sl 2q0Si2+0RLp+lKm4flL2GQll3z/gFXwTYxItPY4kBPFiBuwc2YCIAaHKv5xuZu74l6BTu7xp5Ry kfFseV7P2HzF+Ao4cblXmY35/d/KAlzKP7+IO2MyPjM0BAYtI3uHgYAMnHSjLC2EA8lEFOct8qQ GE+rKYtCewKkgpyuu5dShUhgp9Z30q7c2aj4TFos= X-Google-Smtp-Source: AGHT+IF/vr0JdR7BhUZF/CLVXT/7bWNiAbEwT6msbj/HgBgDO3T/ANvkscC5qNafqYzSb/qLbMi0kQ== X-Received: by 2002:a05:6870:9c89:b0:29e:74a0:e03f with SMTP id 586e51a60fabf-2eab46e5dd7mr2125102fac.24.1749744378382; Thu, 12 Jun 2025 09:06:18 -0700 (PDT) Received: from ?IPV6:2600:8803:e7e4:1d00:4753:719f:673f:547c? ([2600:8803:e7e4:1d00:4753:719f:673f:547c]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2eac0c17211sm221571fac.18.2025.06.12.09.06.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Jun 2025 09:06:18 -0700 (PDT) Message-ID: <1c1c2888-be50-4578-8afd-bfbe4bd9cbae@baylibre.com> Date: Thu, 12 Jun 2025 11:06:16 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 3/3] iio: accel: sca3000: use guard(mutex)() for handling mutex lock To: kernel test robot , Andrew Ijano , 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 References: <20250611194648.18133-4-andrew.lopes@alumni.usp.br> <202506122309.FvJPaMhh-lkp@intel.com> Content-Language: en-US From: David Lechner In-Reply-To: <202506122309.FvJPaMhh-lkp@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 > | 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; }