All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nuno Sá" <noname.nuno@gmail.com>
To: kernel test robot <lkp@intel.com>, oe-kbuild@lists.linux.dev
Cc: Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH 8/8] iio: adc: ad9467: support digital interface calibration
Date: Mon, 22 Apr 2024 09:24:28 +0200	[thread overview]
Message-ID: <d0b732b7490d18cc0751a0dee78c0f34678d4699.camel@gmail.com> (raw)
In-Reply-To: <202404201240.EYJwoHKf-lkp@intel.com>

On Sat, 2024-04-20 at 12:32 +0800, kernel test robot wrote:
> BCC: lkp@intel.com
> CC: oe-kbuild-all@lists.linux.dev
> In-Reply-To: <20240419-ad9467-new-features-v1-8-3e7628ff6d5e@analog.com>
> References: <20240419-ad9467-new-features-v1-8-3e7628ff6d5e@analog.com>
> TO: Nuno Sa via B4 Relay <devnull+nuno.sa.analog.com@kernel.org>
> TO: linux-iio@vger.kernel.org
> TO: devicetree@vger.kernel.org
> CC: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> CC: Alexandru Ardelean <alexandru.ardelean@analog.com>
> CC: "Lars-Peter Clausen" <lars@metafoo.de>
> CC: Michael Hennerich <Michael.Hennerich@analog.com>
> CC: Rob Herring <robh@kernel.org>
> CC: Krzysztof Kozlowski <krzk@kernel.org>
> CC: Conor Dooley <conor+dt@kernel.org>
> CC: Olivier Moysan <olivier.moysan@foss.st.com>
> CC: Nuno Sa <nuno.sa@analog.com>
> 
> Hi Nuno,
> 
> kernel test robot noticed the following build warnings:
> 
> [auto build test WARNING on 62d3fb9dcc091ccdf25eb3b716e90e07e3ed861f]
> 
> url:   
> https://github.com/intel-lab-lkp/linux/commits/Nuno-Sa-via-B4-Relay/iio-backend-add-API-for-interface-tuning/20240419-233948
> base:   62d3fb9dcc091ccdf25eb3b716e90e07e3ed861f
> patch link:   
> https://lore.kernel.org/r/20240419-ad9467-new-features-v1-8-3e7628ff6d5e%40analog.com
> patch subject: [PATCH 8/8] iio: adc: ad9467: support digital interface calibration
> :::::: branch date: 13 hours ago
> :::::: commit date: 13 hours ago
> config: csky-randconfig-r081-20240420
> (https://download.01.org/0day-ci/archive/20240420/202404201240.EYJwoHKf-lkp@intel.c
> om/config)
> compiler: csky-linux-gcc (GCC) 13.2.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>
> > Reported-by: Dan Carpenter <error27@gmail.com>
> > Closes: https://lore.kernel.org/r/202404201240.EYJwoHKf-lkp@intel.com/
> 
> smatch warnings:
> drivers/iio/adc/ad9467.c:587 ad9467_calibrate() error: uninitialized symbol
> 'inv_val'.
> 

It may still be too early for me but I think this is a false positive...
'inv_cnt' which is initialized should control if we access 'inv_val' or not

- Nuno Sá

> vim +/inv_val +587 drivers/iio/adc/ad9467.c
> 
> 65ac942f507d901 Nuno Sa 2024-04-19  523  
> 65ac942f507d901 Nuno Sa 2024-04-19  524  static int ad9467_calibrate(const struct
> ad9467_state *st)
> 65ac942f507d901 Nuno Sa 2024-04-19  525  {
> 65ac942f507d901 Nuno Sa 2024-04-19  526  	DECLARE_BITMAP(err_map,
> AD9647_MAX_TEST_POINTS * 2);
> 65ac942f507d901 Nuno Sa 2024-04-19  527  	unsigned int point, val, inv_val,
> cnt, inv_cnt = 0;
> 65ac942f507d901 Nuno Sa 2024-04-19  528  	/*
> 65ac942f507d901 Nuno Sa 2024-04-19  529  	 * Half of the bitmap is for the
> inverted signal. The number of test
> 65ac942f507d901 Nuno Sa 2024-04-19  530  	 * points is the same though...
> 65ac942f507d901 Nuno Sa 2024-04-19  531  	 */
> 65ac942f507d901 Nuno Sa 2024-04-19  532  	unsigned int test_points =
> AD9647_MAX_TEST_POINTS;
> 65ac942f507d901 Nuno Sa 2024-04-19  533  	unsigned long sample_rate =
> clk_get_rate(st->clk);
> 65ac942f507d901 Nuno Sa 2024-04-19  534  	struct device *dev = &st->spi-
> >dev;
> 65ac942f507d901 Nuno Sa 2024-04-19  535  	bool invert = false, stat;
> 65ac942f507d901 Nuno Sa 2024-04-19  536  	int ret;
> 65ac942f507d901 Nuno Sa 2024-04-19  537  
> 65ac942f507d901 Nuno Sa 2024-04-19  538  	ret =
> ad9647_calibrate_prepare(st);
> 65ac942f507d901 Nuno Sa 2024-04-19  539  	if (ret)
> 65ac942f507d901 Nuno Sa 2024-04-19  540  		return ret;
> 65ac942f507d901 Nuno Sa 2024-04-19  541  retune:
> 65ac942f507d901 Nuno Sa 2024-04-19  542  	ret =
> ad9647_calibrate_polarity_set(st, invert);
> 65ac942f507d901 Nuno Sa 2024-04-19  543  	if (ret)
> 65ac942f507d901 Nuno Sa 2024-04-19  544  		return ret;
> 65ac942f507d901 Nuno Sa 2024-04-19  545  
> 65ac942f507d901 Nuno Sa 2024-04-19  546  	for (point = 0; point <
> test_points; point++) {
> 65ac942f507d901 Nuno Sa 2024-04-19  547  		ret =
> ad9467_calibrate_apply(st, point);
> 65ac942f507d901 Nuno Sa 2024-04-19  548  		if (ret)
> 65ac942f507d901 Nuno Sa 2024-04-19  549  			return ret;
> 65ac942f507d901 Nuno Sa 2024-04-19  550  
> 65ac942f507d901 Nuno Sa 2024-04-19  551  		ret =
> ad9467_calibrate_status_check(st, &stat);
> 65ac942f507d901 Nuno Sa 2024-04-19  552  		if (ret < 0)
> 65ac942f507d901 Nuno Sa 2024-04-19  553  			return ret;
> 65ac942f507d901 Nuno Sa 2024-04-19  554  
> 65ac942f507d901 Nuno Sa 2024-04-19  555  		__assign_bit(point +
> invert * test_points, err_map, stat);
> 65ac942f507d901 Nuno Sa 2024-04-19  556  	}
> 65ac942f507d901 Nuno Sa 2024-04-19  557  
> 65ac942f507d901 Nuno Sa 2024-04-19  558  	if (!invert) {
> 65ac942f507d901 Nuno Sa 2024-04-19  559  		cnt =
> ad9467_find_optimal_point(err_map, 0, test_points, &val);
> 65ac942f507d901 Nuno Sa 2024-04-19  560  		/*
> 65ac942f507d901 Nuno Sa 2024-04-19  561  		 * We're happy if we find,
> at least, three good test points in
> 65ac942f507d901 Nuno Sa 2024-04-19  562  		 * a row.
> 65ac942f507d901 Nuno Sa 2024-04-19  563  		 */
> 65ac942f507d901 Nuno Sa 2024-04-19  564  		if (cnt < 3) {
> 65ac942f507d901 Nuno Sa 2024-04-19  565  			invert = true;
> 65ac942f507d901 Nuno Sa 2024-04-19  566  			goto retune;
> 65ac942f507d901 Nuno Sa 2024-04-19  567  		}
> 65ac942f507d901 Nuno Sa 2024-04-19  568  	} else {
> 65ac942f507d901 Nuno Sa 2024-04-19  569  		inv_cnt =
> ad9467_find_optimal_point(err_map, test_points,
> 65ac942f507d901 Nuno Sa 2024-04-19 
> 570  						    test_points, &inv_val);
> 65ac942f507d901 Nuno Sa 2024-04-19  571  		if (!inv_cnt && !cnt)
> 65ac942f507d901 Nuno Sa 2024-04-19  572  			return -EIO;
> 65ac942f507d901 Nuno Sa 2024-04-19  573  	}
> 65ac942f507d901 Nuno Sa 2024-04-19  574  
> 65ac942f507d901 Nuno Sa 2024-04-19  575  	ad9467_dump_table(err_map,
> BITS_PER_TYPE(err_map), invert);
> 65ac942f507d901 Nuno Sa 2024-04-19  576  
> 65ac942f507d901 Nuno Sa 2024-04-19  577  	if (inv_cnt < cnt) {
> 65ac942f507d901 Nuno Sa 2024-04-19  578  		ret =
> ad9647_calibrate_polarity_set(st, false);
> 65ac942f507d901 Nuno Sa 2024-04-19  579  		if (ret)
> 65ac942f507d901 Nuno Sa 2024-04-19  580  			return ret;
> 65ac942f507d901 Nuno Sa 2024-04-19  581  	} else {
> 65ac942f507d901 Nuno Sa 2024-04-19  582  		/*
> 65ac942f507d901 Nuno Sa 2024-04-19  583  		 * polarity inverted is
> the last test to run. Hence, there's no
> 65ac942f507d901 Nuno Sa 2024-04-19  584  		 * need to re-do any
> configuration. We just need to "normalize"
> 65ac942f507d901 Nuno Sa 2024-04-19  585  		 * the selected value.
> 65ac942f507d901 Nuno Sa 2024-04-19  586  		 */
> 65ac942f507d901 Nuno Sa 2024-04-19 @587  		val = inv_val -
> test_points;
> 65ac942f507d901 Nuno Sa 2024-04-19  588  	}
> 65ac942f507d901 Nuno Sa 2024-04-19  589  
> 65ac942f507d901 Nuno Sa 2024-04-19  590  	if (st->info->has_dco)
> 65ac942f507d901 Nuno Sa 2024-04-19  591  		dev_dbg(dev, "%sDCO 0x%X
> CLK %lu Hz\n", inv_cnt >= cnt ? "INVERT " : "",
> 65ac942f507d901 Nuno Sa 2024-04-19  592  			val, sample_rate);
> 65ac942f507d901 Nuno Sa 2024-04-19  593  	else
> 65ac942f507d901 Nuno Sa 2024-04-19  594  		dev_dbg(dev, "%sIDELAY
> 0x%x\n", inv_cnt >= cnt ? "INVERT " : "",
> 65ac942f507d901 Nuno Sa 2024-04-19  595  			val);
> 65ac942f507d901 Nuno Sa 2024-04-19  596  
> 65ac942f507d901 Nuno Sa 2024-04-19  597  	ret = ad9467_calibrate_apply(st,
> val);
> 65ac942f507d901 Nuno Sa 2024-04-19  598  	if (ret)
> 65ac942f507d901 Nuno Sa 2024-04-19  599  		return ret;
> 65ac942f507d901 Nuno Sa 2024-04-19  600  
> 65ac942f507d901 Nuno Sa 2024-04-19  601  	/* finally apply the optimal value
> */
> 65ac942f507d901 Nuno Sa 2024-04-19  602  	return ad9647_calibrate_stop(st);
> 65ac942f507d901 Nuno Sa 2024-04-19  603  }
> 65ac942f507d901 Nuno Sa 2024-04-19  604  
> 


  reply	other threads:[~2024-04-22  7:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-20  4:32 [PATCH 8/8] iio: adc: ad9467: support digital interface calibration kernel test robot
2024-04-22  7:24 ` Nuno Sá [this message]
2024-04-22 14:09   ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2024-04-19 15:36 [PATCH 0/8] iio: ad9467: support interface tuning Nuno Sa via B4 Relay
2024-04-19 15:36 ` [PATCH 8/8] iio: adc: ad9467: support digital interface calibration Nuno Sa via B4 Relay
2024-04-19 15:36   ` Nuno Sa
2024-04-20 15:34   ` Jonathan Cameron
2024-04-23  7:32     ` Nuno Sá

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=d0b732b7490d18cc0751a0dee78c0f34678d4699.camel@gmail.com \
    --to=noname.nuno@gmail.com \
    --cc=error27@gmail.com \
    --cc=lkp@intel.com \
    --cc=oe-kbuild@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.