* [broonie-ci:spi-7.2 9/9] drivers/spi/spi-spacemit-k1.c:393:31: warning: overflow in expression; result is -589934592 with type 'long'
@ 2026-05-04 20:12 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-05-04 20:12 UTC (permalink / raw)
To: Alex Elder; +Cc: llvm, oe-kbuild-all, Mark Brown, Guodong Xu
tree: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/ci.git spi-7.2
head: efcd8b9d111177d48c841d09beca43b15d5b9e5f
commit: efcd8b9d111177d48c841d09beca43b15d5b9e5f [9/9] spi: spacemit: introduce SpacemiT K1 SPI controller driver
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20260505/202605050437.RS6mmV2b-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260505/202605050437.RS6mmV2b-lkp@intel.com/reproduce)
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/202605050437.RS6mmV2b-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/spi/spi-spacemit-k1.c:393:31: warning: overflow in expression; result is -589934592 with type 'long' [-Winteger-overflow]
393 | nsec_per_word = NSEC_PER_SEC * BITS_PER_BYTE * drv_data->bytes;
| ^
1 warning generated.
vim +/long +393 drivers/spi/spi-spacemit-k1.c
356
357 /* Set the transfer speed; the SPI core code ensures it is supported */
358 static int k1_spi_set_speed(struct k1_spi_driver_data *drv_data,
359 struct spi_transfer *transfer)
360 {
361 struct clk *clk = drv_data->clk;
362 u64 nsec_per_word;
363 u64 bus_ticks;
364 u32 timeout;
365 u32 val;
366 int ret;
367
368 ret = clk_set_rate(clk, transfer->speed_hz);
369 if (ret)
370 return ret;
371
372 drv_data->rate = clk_get_rate(clk);
373
374 /* No need for RX FIFO timeout if we're not receiving anything */
375 if (!transfer->rx_buf)
376 return 0;
377
378 /*
379 * Compute the RX FIFO inactivity timeout value that should be used.
380 * The inactivity timer restarts with each word that lands in the
381 * FIFO. If several "word transfer times" pass without any new data
382 * in the RX FIFO, we might as well read what's there.
383 *
384 * The rate at which words land in the FIFO is determined by the
385 * word size and the transfer rate. One bit is transferred per
386 * clock tick, and 8 (or 16 or 32) bits are transferred per word.
387 *
388 * So we can get word transfer time (in nanoseconds) from:
389 * nsec_per_tick = NSEC_PER_SEC / drv_data->rate;
390 * ticks_per_word = BITS_PER_BYTE * drv_data->bytes;
391 * We do the divide last for better accuracy.
392 */
> 393 nsec_per_word = NSEC_PER_SEC * BITS_PER_BYTE * drv_data->bytes;
394 nsec_per_word = DIV_ROUND_UP_ULL(nsec_per_word, drv_data->rate);
395
396 /*
397 * The timeout (which we'll set to three word transfer times) is
398 * expressed as a number of APB clock ticks.
399 * bus_ticks = 3 * nsec * (drv_data->bus_rate / NSEC_PER_SEC)
400 */
401 bus_ticks = 3 * nsec_per_word * drv_data->bus_rate;
402 timeout = DIV_ROUND_UP_ULL(bus_ticks, NSEC_PER_SEC);
403
404 /* Set the RX timeout period (required for both DMA and PIO) */
405 val = FIELD_PREP(SSP_TIMEOUT_MASK, timeout);
406 writel(val, drv_data->base + SSP_TIMEOUT);
407
408 return 0;
409 }
410
--
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-05-04 20:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-04 20:12 [broonie-ci:spi-7.2 9/9] drivers/spi/spi-spacemit-k1.c:393:31: warning: overflow in expression; result is -589934592 with type 'long' kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox