* [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'
@ 2026-07-04 12:27 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-07-04 12:27 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-04 12:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-04 12:27 [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' kernel test robot
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.