devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: kernel test robot <lkp@intel.com>
Cc: "Mariel Tinaco" <Mariel.Tinaco@analog.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Marcelo Schmitt" <marcelo.schmitt1@gmail.com>,
	"Dimitri Fedrau" <dima.fedrau@gmail.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <noname.nuno@gmail.com>,
	oe-kbuild-all@lists.linux.dev
Subject: Re: [PATCH v4 2/2] iio: dac: support the ad8460 Waveform DAC
Date: Sat, 28 Sep 2024 15:13:58 +0100	[thread overview]
Message-ID: <20240928151358.220e3edf@jic23-huawei> (raw)
In-Reply-To: <202409210849.cRodncgA-lkp@intel.com>

On Sat, 21 Sep 2024 09:11:12 +0800
kernel test robot <lkp@intel.com> wrote:

> Hi Mariel,
> 
> kernel test robot noticed the following build warnings:
> 
> [auto build test WARNING on fec496684388685647652ab4213454fbabdab099]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Mariel-Tinaco/dt-bindings-iio-dac-add-docs-for-ad8460/20240912-175718
> base:   fec496684388685647652ab4213454fbabdab099
> patch link:    https://lore.kernel.org/r/20240912095435.18639-3-Mariel.Tinaco%40analog.com
> patch subject: [PATCH v4 2/2] iio: dac: support the ad8460 Waveform DAC
> config: sparc-randconfig-r071-20240921 (https://download.01.org/0day-ci/archive/20240921/202409210849.cRodncgA-lkp@intel.com/config)
> compiler: sparc64-linux-gcc (GCC) 14.1.0
> 
> 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/202409210849.cRodncgA-lkp@intel.com/
> 
> smatch warnings:
> drivers/iio/dac/ad8460.c:545 ad8460_write_event_value() warn: unsigned 'fault' is never less than zero.
> drivers/iio/dac/ad8460.c:545 ad8460_write_event_value() warn: error code type promoted to positive: 'fault'
> drivers/iio/dac/ad8460.c:567 ad8460_read_event_value() warn: unsigned 'fault' is never less than zero.
> drivers/iio/dac/ad8460.c:567 ad8460_read_event_value() warn: error code type promoted to positive: 'fault'
> drivers/iio/dac/ad8460.c:585 ad8460_write_event_config() warn: unsigned 'fault' is never less than zero.
> drivers/iio/dac/ad8460.c:585 ad8460_write_event_config() warn: error code type promoted to positive: 'fault'
> drivers/iio/dac/ad8460.c:605 ad8460_read_event_config() warn: unsigned 'fault' is never less than zero.
> drivers/iio/dac/ad8460.c:605 ad8460_read_event_config() warn: error code type promoted to positive: 'fault'
> 
> vim +/fault +545 drivers/iio/dac/ad8460.c
> 
>    528	
>    529	static int ad8460_write_event_value(struct iio_dev *indio_dev,
>    530					    const struct iio_chan_spec *chan,
>    531					    enum iio_event_type type,
>    532					    enum iio_event_direction dir,
>    533					    enum iio_event_info info, int val, int val2)
>    534	{
>    535		struct ad8460_state *state = iio_priv(indio_dev);
>    536		unsigned int fault;
I fixed this up by making all the local fault variables int instead.

Jonathan

>    537	
>    538		if (type != IIO_EV_TYPE_THRESH)
>    539			return -EINVAL;
>    540	
>    541		if (info != IIO_EV_INFO_VALUE)
>    542			return -EINVAL;
>    543	
>    544		fault = ad8460_select_fault_type(chan->type, dir);
>  > 545		if (fault < 0)  
>    546			return fault;
>    547	
>    548		return ad8460_set_fault_threshold(state, fault, val);
>    549	}
>    550	
>    551	static int ad8460_read_event_value(struct iio_dev *indio_dev,
>    552					   const struct iio_chan_spec *chan,
>    553					   enum iio_event_type type,
>    554					   enum iio_event_direction dir,
>    555					   enum iio_event_info info, int *val, int *val2)
>    556	{
>    557		struct ad8460_state *state = iio_priv(indio_dev);
>    558		unsigned int fault;
>    559	
>    560		if (type != IIO_EV_TYPE_THRESH)
>    561			return -EINVAL;
>    562	
>    563		if (info != IIO_EV_INFO_VALUE)
>    564			return -EINVAL;
>    565	
>    566		fault = ad8460_select_fault_type(chan->type, dir);
>  > 567		if (fault < 0)  
>    568			return fault;
>    569	
>    570		return ad8460_get_fault_threshold(state, fault, val);
>    571	}
>    572	
>    573	static int ad8460_write_event_config(struct iio_dev *indio_dev,
>    574					     const struct iio_chan_spec *chan,
>    575					     enum iio_event_type type,
>    576					     enum iio_event_direction dir, int val)
>    577	{
>    578		struct ad8460_state *state = iio_priv(indio_dev);
>    579		unsigned int fault;
>    580	
>    581		if (type != IIO_EV_TYPE_THRESH)
>    582			return -EINVAL;
>    583	
>    584		fault = ad8460_select_fault_type(chan->type, dir);
>  > 585		if (fault < 0)  
>    586			return fault;
>    587	
>    588		return ad8460_set_fault_threshold_en(state, fault, val);
>    589	}
>    590	
>    591	static int ad8460_read_event_config(struct iio_dev *indio_dev,
>    592					    const struct iio_chan_spec *chan,
>    593					    enum iio_event_type type,
>    594					    enum iio_event_direction dir)
>    595	{
>    596		struct ad8460_state *state = iio_priv(indio_dev);
>    597		unsigned int fault;
>    598		bool en;
>    599		int ret;
>    600	
>    601		if (type != IIO_EV_TYPE_THRESH)
>    602			return -EINVAL;
>    603	
>    604		fault = ad8460_select_fault_type(chan->type, dir);
>  > 605		if (fault < 0)  
>    606			return fault;
>    607	
>    608		ret = ad8460_get_fault_threshold_en(state, fault, &en);
>    609		if (ret)
>    610			return ret;
>    611	
>    612		return en;
>    613	}
>    614	
> 


      reply	other threads:[~2024-09-28 14:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-12  9:54 [PATCH v4 0/2] add AD8460 DAC driver Mariel Tinaco
2024-09-12  9:54 ` [PATCH v4 1/2] dt-bindings: iio: dac: add docs for ad8460 Mariel Tinaco
2024-09-16  8:57   ` Krzysztof Kozlowski
2024-09-12  9:54 ` [PATCH v4 2/2] iio: dac: support the ad8460 Waveform DAC Mariel Tinaco
2024-09-14 17:18   ` Jonathan Cameron
2024-09-14 18:21   ` Christophe JAILLET
2024-09-28 14:19     ` Jonathan Cameron
2024-09-30  4:28       ` Tinaco, Mariel
2024-09-30  8:40         ` Jonathan Cameron
2024-09-30  6:29       ` Tinaco, Mariel
2024-09-21  1:11   ` kernel test robot
2024-09-28 14:13     ` Jonathan Cameron [this message]

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=20240928151358.220e3edf@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Mariel.Tinaco@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dima.fedrau@gmail.com \
    --cc=dlechner@baylibre.com \
    --cc=krzk@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=marcelo.schmitt1@gmail.com \
    --cc=noname.nuno@gmail.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=robh@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).