From: kernel test robot <lkp@intel.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
linux-arm-kernel@lists.infradead.org
Subject: [nomadik:ux500-janice-v5.10-rc1 38/51] drivers/iio/magnetometer/yamaha-yas530.c:286:2: warning: variable 'coef' is used uninitialized whenever switch default is taken
Date: Sun, 13 Dec 2020 03:31:58 +0800 [thread overview]
Message-ID: <202012130356.iCuRd8hD-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3912 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git ux500-janice-v5.10-rc1
head: e2561a704fc03cbda012da31198333381b72386d
commit: 757460dad8873d91c4b243b47fbf39514b86b92a [38/51] iio: magnetometer: Add driver for Yamaha YAS530
config: powerpc64-randconfig-r024-20201213 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 84c09ab44599ece409e4e19761288ddf796fceec)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc64 cross compiling tool for clang build
# apt-get install binutils-powerpc64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git/commit/?id=757460dad8873d91c4b243b47fbf39514b86b92a
git remote add nomadik https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git
git fetch --no-tags nomadik ux500-janice-v5.10-rc1
git checkout 757460dad8873d91c4b243b47fbf39514b86b92a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/iio/magnetometer/yamaha-yas530.c:286:2: warning: variable 'coef' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
default:
^~~~~~~
drivers/iio/magnetometer/yamaha-yas530.c:299:47: note: uninitialized use occurs here
(yas5xx->hard_offsets[axis] - c->r[axis]) * coef;
^~~~
drivers/iio/magnetometer/yamaha-yas530.c:269:10: note: initialize the variable 'coef' to silence this warning
s32 coef;
^
= 0
>> drivers/iio/magnetometer/yamaha-yas530.c:674:6: warning: no previous prototype for function 'yas5xx_dump_calibration' [-Wmissing-prototypes]
void yas5xx_dump_calibration(struct yas5xx *yas5xx)
^
drivers/iio/magnetometer/yamaha-yas530.c:674:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void yas5xx_dump_calibration(struct yas5xx *yas5xx)
^
static
2 warnings generated.
vim +/coef +286 drivers/iio/magnetometer/yamaha-yas530.c
260
261 static s32 yas5xx_linearize(struct yas5xx *yas5xx, u16 val, int axis)
262 {
263 struct yas5xx_calibration *c = &yas5xx->calibration;
264 static const s32 yas532ac_coef[] = {
265 YAS532_VERSION_AC_COEF_X,
266 YAS532_VERSION_AC_COEF_Y1,
267 YAS532_VERSION_AC_COEF_Y2,
268 };
269 s32 coef;
270
271 /* Select coefficients */
272 switch (yas5xx->devid) {
273 case YAS530_DEVICE_ID:
274 if (yas5xx->version == YAS530_VERSION_A)
275 coef = YAS530_VERSION_A_COEF;
276 else
277 coef = YAS530_VERSION_B_COEF;
278 break;
279 case YAS532_DEVICE_ID:
280 if (yas5xx->version == YAS532_VERSION_AB)
281 coef = YAS532_VERSION_AB_COEF;
282 else
283 /* Elaborate coefficients */
284 coef = yas532ac_coef[axis];
285 break;
> 286 default:
287 dev_err(yas5xx->dev, "unknown device type\n");
288 break;
289 }
290 /*
291 * Linearization formula:
292 *
293 * x' = x - (3721 + 50 * f) + (xoffset - r) * c
294 *
295 * Where f and r are calibration values, c is a per-device
296 * and sometimes per-axis coefficient.
297 */
298 return val - (3721 + 50 * c->f[axis]) +
> 299 (yas5xx->hard_offsets[axis] - c->r[axis]) * coef;
300 }
301
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37694 bytes --]
[-- Attachment #3: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
reply other threads:[~2020-12-12 19:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202012130356.iCuRd8hD-lkp@intel.com \
--to=lkp@intel.com \
--cc=clang-built-linux@googlegroups.com \
--cc=kbuild-all@lists.01.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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).