lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aFL-dLs5EQsde8Cq@smile.fi.intel.com>
Date: Wed, 18 Jun 2025 20:59:16 +0300
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: oe-kbuild@...ts.linux.dev, Marcelo Schmitt <marcelo.schmitt@...log.com>,
	linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
	linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
	lkp@...el.com, oe-kbuild-all@...ts.linux.dev,
	Ana-Maria Cusco <ana-maria.cusco@...log.com>, jic23@...nel.org,
	lars@...afoo.de, Michael.Hennerich@...log.com,
	dlechner@...libre.com, nuno.sa@...log.com, andy@...nel.org,
	robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
	linus.walleij@...aro.org, brgl@...ev.pl, marcelo.schmitt1@...il.com
Subject: Re: [PATCH v5 02/11] iio: adc: Add basic support for AD4170

On Wed, Jun 18, 2025 at 08:37:53PM +0300, Dan Carpenter wrote:
> Hi Marcelo,
> 
> kernel test robot noticed the following build warnings:
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Marcelo-Schmitt/dt-bindings-iio-adc-Add-AD4170/20250611-101842
> base:   4c6073fec2fee4827fa0dd8a4ab4e6f7bbc05ee6
> patch link:    https://lore.kernel.org/r/48598c0753cccf515addbe85acba3f883ff8f036.1749582679.git.marcelo.schmitt%40analog.com
> patch subject: [PATCH v5 02/11] iio: adc: Add basic support for AD4170
> config: powerpc-randconfig-r072-20250613 (https://download.01.org/0day-ci/archive/20250614/202506140009.GdV0BtKr-lkp@intel.com/config)
> compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
> 
> 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@...el.com>
> | Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> | Closes: https://lore.kernel.org/r/202506140009.GdV0BtKr-lkp@intel.com/
> 
> smatch warnings:
> drivers/iio/adc/ad4170.c:1181 ad4170_parse_adc_channel_type() warn: passing zero to 'dev_err_probe'
> 
> vim +/dev_err_probe +1181 drivers/iio/adc/ad4170.c
> 
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1170  static int ad4170_parse_adc_channel_type(struct device *dev,
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1171  					 struct fwnode_handle *child,
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1172  					 struct iio_chan_spec *chan)
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1173  {
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1174  	int ret, ret2;
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1175  	u32 pins[2];
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1176  
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1177  	/* Parse pseudo-differential channel configuration */
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1178  	ret = fwnode_property_read_u32(child, "single-channel", &pins[0]);
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1179  	ret2 = fwnode_property_read_u32(child, "common-mode-channel", &pins[1]);
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1180  	if (!ret && ret2)
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10 @1181  		return dev_err_probe(dev, ret,
>                                                                                           ^^^
> ret is zero, so this returns success.  s/ret/ret2/.
> 
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1182  			"single-ended channels must define common-mode-channel\n");

Instead of ret and ret2 this code should be refactored to use
_preperty_present() beforehands and return an error to the caller if it's
present but failed to be read or not optional at all.

> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1184  	if (!ret && !ret2) {
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1185  		chan->differential = false;
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1186  		chan->channel = pins[0];
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1187  		chan->channel2 = pins[1];
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1188  		return 0;
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1189  	}
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1190  	/* Failed to parse pseudo-diff chan props so try diff chan */
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1191  
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1192  	/* Parse differential channel configuration */
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1193  	ret = fwnode_property_read_u32_array(child, "diff-channels", pins,
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1194  					     ARRAY_SIZE(pins));
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1195  	if (!ret) {
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1196  		chan->differential = true;
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1197  		chan->channel = pins[0];
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1198  		chan->channel2 = pins[1];
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1199  		return 0;
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1200  	}
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1201  	return dev_err_probe(dev, ret,
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1202  		"Channel must define one of diff-channels or single-channel.\n");
> dfefd2b2405829 Ana-Maria Cusco 2025-06-10  1203  }

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ