From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [jic23-iio:testing 83/118] drivers/iio/imu/adis16550.c:911 adis16550_config_sync() warn: '(__x + (__d / 2)) / __d' 123456789 can't fit into 65535 'sync_scale'
Date: Sat, 04 Jul 2026 20:27:30 +0800 [thread overview]
Message-ID: <202607042029.JPsbMNiw-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
CC: Jonathan Cameron <jic23@kernel.org>
CC: "Nuno Sá" <nuno.sa@analog.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
head: b4d8a2e93ff3d963f672e2e8c866caf35585139a
commit: d9df71de85c2687d4250f8662296902bed430458 [83/118] iio: imu: adis16550: Simplify device abstraction
:::::: branch date: 18 hours ago
:::::: commit date: 3 days ago
config: hexagon-randconfig-r072-20260704 (https://download.01.org/0day-ci/archive/20260704/202607042029.JPsbMNiw-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 0a2fb2a2269da0e2a3e230beb6cad39ca314db33)
smatch: v0.5.0-9185-gbcc58b9c
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/202607042029.JPsbMNiw-lkp@intel.com/
smatch warnings:
drivers/iio/imu/adis16550.c:911 adis16550_config_sync() warn: '(__x + (__d / 2)) / __d' 123456789 can't fit into 65535 'sync_scale'
vim +911 drivers/iio/imu/adis16550.c
bac4368fab62c72 Robert Budai 2025-02-17 873
bac4368fab62c72 Robert Budai 2025-02-17 874 static int adis16550_config_sync(struct adis16550 *st)
bac4368fab62c72 Robert Budai 2025-02-17 875 {
bac4368fab62c72 Robert Budai 2025-02-17 876 struct device *dev = &st->adis.spi->dev;
bac4368fab62c72 Robert Budai 2025-02-17 877 const struct adis16550_sync *sync_mode_data;
bac4368fab62c72 Robert Budai 2025-02-17 878 struct clk *clk;
bac4368fab62c72 Robert Budai 2025-02-17 879 int ret, i;
bac4368fab62c72 Robert Budai 2025-02-17 880 u16 mode;
bac4368fab62c72 Robert Budai 2025-02-17 881
bac4368fab62c72 Robert Budai 2025-02-17 882 clk = devm_clk_get_optional_enabled(dev, NULL);
bac4368fab62c72 Robert Budai 2025-02-17 883 if (IS_ERR(clk))
bac4368fab62c72 Robert Budai 2025-02-17 884 return PTR_ERR(clk);
bac4368fab62c72 Robert Budai 2025-02-17 885 if (!clk) {
d9df71de85c2687 Uwe Kleine-König (The Capable Hub 2026-06-30 886) st->clk_freq_hz = 4000000;
bac4368fab62c72 Robert Budai 2025-02-17 887 return 0;
bac4368fab62c72 Robert Budai 2025-02-17 888 }
bac4368fab62c72 Robert Budai 2025-02-17 889
bac4368fab62c72 Robert Budai 2025-02-17 890 st->clk_freq_hz = clk_get_rate(clk);
bac4368fab62c72 Robert Budai 2025-02-17 891
d9df71de85c2687 Uwe Kleine-König (The Capable Hub 2026-06-30 892) for (i = 0; i < ARRAY_SIZE(adis16550_sync_modes); i++) {
d9df71de85c2687 Uwe Kleine-König (The Capable Hub 2026-06-30 893) if (st->clk_freq_hz >= adis16550_sync_modes[i].min_rate &&
d9df71de85c2687 Uwe Kleine-König (The Capable Hub 2026-06-30 894) st->clk_freq_hz <= adis16550_sync_modes[i].max_rate) {
d9df71de85c2687 Uwe Kleine-König (The Capable Hub 2026-06-30 895) sync_mode_data = &adis16550_sync_modes[i];
bac4368fab62c72 Robert Budai 2025-02-17 896 break;
bac4368fab62c72 Robert Budai 2025-02-17 897 }
bac4368fab62c72 Robert Budai 2025-02-17 898 }
bac4368fab62c72 Robert Budai 2025-02-17 899
d9df71de85c2687 Uwe Kleine-König (The Capable Hub 2026-06-30 900) if (i == ARRAY_SIZE(adis16550_sync_modes))
bac4368fab62c72 Robert Budai 2025-02-17 901 return dev_err_probe(dev, -EINVAL, "Clk rate: %lu not in a valid range",
bac4368fab62c72 Robert Budai 2025-02-17 902 st->clk_freq_hz);
bac4368fab62c72 Robert Budai 2025-02-17 903
bac4368fab62c72 Robert Budai 2025-02-17 904 if (sync_mode_data->sync_mode == ADIS16550_SYNC_MODE_SCALED) {
bac4368fab62c72 Robert Budai 2025-02-17 905 u16 sync_scale;
bac4368fab62c72 Robert Budai 2025-02-17 906 /*
bac4368fab62c72 Robert Budai 2025-02-17 907 * In sps scaled sync we must scale the input clock to a range
bac4368fab62c72 Robert Budai 2025-02-17 908 * of [3000 4500].
bac4368fab62c72 Robert Budai 2025-02-17 909 */
bac4368fab62c72 Robert Budai 2025-02-17 910
d9df71de85c2687 Uwe Kleine-König (The Capable Hub 2026-06-30 @911) sync_scale = DIV_ROUND_CLOSEST(4000, st->clk_freq_hz);
bac4368fab62c72 Robert Budai 2025-02-17 912
bac4368fab62c72 Robert Budai 2025-02-17 913 if (3000 > sync_scale || 4500 < sync_scale)
bac4368fab62c72 Robert Budai 2025-02-17 914 return dev_err_probe(dev, -EINVAL,
bac4368fab62c72 Robert Budai 2025-02-17 915 "Invalid value:%u for sync_scale",
bac4368fab62c72 Robert Budai 2025-02-17 916 sync_scale);
bac4368fab62c72 Robert Budai 2025-02-17 917
bac4368fab62c72 Robert Budai 2025-02-17 918 ret = adis_write_reg_16(&st->adis, ADIS16550_REG_SYNC_SCALE,
bac4368fab62c72 Robert Budai 2025-02-17 919 sync_scale);
bac4368fab62c72 Robert Budai 2025-02-17 920 if (ret)
bac4368fab62c72 Robert Budai 2025-02-17 921 return ret;
bac4368fab62c72 Robert Budai 2025-02-17 922
d9df71de85c2687 Uwe Kleine-König (The Capable Hub 2026-06-30 923) st->clk_freq_hz = 4000;
bac4368fab62c72 Robert Budai 2025-02-17 924 }
bac4368fab62c72 Robert Budai 2025-02-17 925
bac4368fab62c72 Robert Budai 2025-02-17 926 st->clk_freq_hz *= 1000;
bac4368fab62c72 Robert Budai 2025-02-17 927
bac4368fab62c72 Robert Budai 2025-02-17 928 mode = FIELD_PREP(ADIS16550_SYNC_MODE_MASK, sync_mode_data->sync_mode) |
bac4368fab62c72 Robert Budai 2025-02-17 929 FIELD_PREP(ADIS16550_SYNC_EN_MASK, true);
bac4368fab62c72 Robert Budai 2025-02-17 930
bac4368fab62c72 Robert Budai 2025-02-17 931 return __adis_update_bits(&st->adis, ADIS16550_REG_CONFIG,
bac4368fab62c72 Robert Budai 2025-02-17 932 ADIS16550_SYNC_MASK, mode);
bac4368fab62c72 Robert Budai 2025-02-17 933 }
bac4368fab62c72 Robert Budai 2025-02-17 934
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-07-04 12:27 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=202607042029.JPsbMNiw-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.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.