mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* drivers/iio/common/scmi_sensors/scmi_iio.c:247:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead.
@ 2026-06-03 18:33 kernel test robot
  2026-06-04  7:16 ` Geert Uytterhoeven
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2026-06-03 18:33 UTC (permalink / raw)
  To: Tiwei Bie; +Cc: oe-kbuild-all, linux-kernel, Johannes Berg

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   ba3e43a9e601636f5edb54e259a74f96ca3b8fd8
commit: a0e2cb6a90634f3dc80f16e882a683ee5761b0b0 um: Add VFIO-based virtual PCI driver
date:   1 year, 1 month ago
config: um-randconfig-r052-20260603 (https://download.01.org/0day-ci/archive/20260604/202606040245.XfmRpBhA-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project e5ab4f8a1f766febdc65ce89c00dec85393cfd68)

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
| Fixes: a0e2cb6a9063 ("um: Add VFIO-based virtual PCI driver")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606040245.XfmRpBhA-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> drivers/iio/common/scmi_sensors/scmi_iio.c:247:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead.
   drivers/iio/common/scmi_sensors/scmi_iio.c:507:2-8: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead.
   drivers/iio/common/scmi_sensors/scmi_iio.c:273:2-8: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead.
   drivers/iio/common/scmi_sensors/scmi_iio.c:166:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead.

vim +247 drivers/iio/common/scmi_sensors/scmi_iio.c

f774117c96f94c Jyoti Bhayana 2021-03-09  238  
f774117c96f94c Jyoti Bhayana 2021-03-09  239  static void convert_ns_to_freq(u64 interval_ns, u64 *hz, u64 *uhz)
f774117c96f94c Jyoti Bhayana 2021-03-09  240  {
f774117c96f94c Jyoti Bhayana 2021-03-09  241  	u64 rem, freq;
f774117c96f94c Jyoti Bhayana 2021-03-09  242  
f774117c96f94c Jyoti Bhayana 2021-03-09  243  	freq = NSEC_PER_SEC;
f774117c96f94c Jyoti Bhayana 2021-03-09  244  	rem = do_div(freq, interval_ns);
f774117c96f94c Jyoti Bhayana 2021-03-09  245  	*hz = freq;
f774117c96f94c Jyoti Bhayana 2021-03-09  246  	*uhz = rem * 1000000UL;
f774117c96f94c Jyoti Bhayana 2021-03-09 @247  	do_div(*uhz, interval_ns);
f774117c96f94c Jyoti Bhayana 2021-03-09  248  }
f774117c96f94c Jyoti Bhayana 2021-03-09  249  

:::::: The code at line 247 was first introduced by commit
:::::: f774117c96f94c7c4d2f076e4cacc80218b0df48 iio/scmi: Adding support for IIO SCMI Based Sensors

:::::: TO: Jyoti Bhayana <jbhayana@google.com>
:::::: CC: Jonathan Cameron <Jonathan.Cameron@huawei.com>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: drivers/iio/common/scmi_sensors/scmi_iio.c:247:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead.
  2026-06-03 18:33 drivers/iio/common/scmi_sensors/scmi_iio.c:247:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead kernel test robot
@ 2026-06-04  7:16 ` Geert Uytterhoeven
  0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2026-06-04  7:16 UTC (permalink / raw)
  To: kernel test robot
  Cc: Tiwei Bie, oe-kbuild-all, linux-kernel, Johannes Berg,
	Jyoti Bhayana, Jonathan Cameron,
	open list:IIO SUBSYSTEM AND DRIVERS, arm-scmi

CC IIO/SCMI

On Wed, 3 Jun 2026 at 20:36, kernel test robot <lkp@intel.com> wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   ba3e43a9e601636f5edb54e259a74f96ca3b8fd8
> commit: a0e2cb6a90634f3dc80f16e882a683ee5761b0b0 um: Add VFIO-based virtual PCI driver
> date:   1 year, 1 month ago
> config: um-randconfig-r052-20260603 (https://download.01.org/0day-ci/archive/20260604/202606040245.XfmRpBhA-lkp@intel.com/config)
> compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project e5ab4f8a1f766febdc65ce89c00dec85393cfd68)
>
> 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
> | Fixes: a0e2cb6a9063 ("um: Add VFIO-based virtual PCI driver")
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202606040245.XfmRpBhA-lkp@intel.com/
>
> cocci warnings: (new ones prefixed by >>)
> >> drivers/iio/common/scmi_sensors/scmi_iio.c:247:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead.
>    drivers/iio/common/scmi_sensors/scmi_iio.c:507:2-8: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead.
>    drivers/iio/common/scmi_sensors/scmi_iio.c:273:2-8: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead.
>    drivers/iio/common/scmi_sensors/scmi_iio.c:166:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead.
>
> vim +247 drivers/iio/common/scmi_sensors/scmi_iio.c
>
> f774117c96f94c Jyoti Bhayana 2021-03-09  238
> f774117c96f94c Jyoti Bhayana 2021-03-09  239  static void convert_ns_to_freq(u64 interval_ns, u64 *hz, u64 *uhz)
> f774117c96f94c Jyoti Bhayana 2021-03-09  240  {
> f774117c96f94c Jyoti Bhayana 2021-03-09  241    u64 rem, freq;
> f774117c96f94c Jyoti Bhayana 2021-03-09  242
> f774117c96f94c Jyoti Bhayana 2021-03-09  243    freq = NSEC_PER_SEC;
> f774117c96f94c Jyoti Bhayana 2021-03-09  244    rem = do_div(freq, interval_ns);
> f774117c96f94c Jyoti Bhayana 2021-03-09  245    *hz = freq;
> f774117c96f94c Jyoti Bhayana 2021-03-09  246    *uhz = rem * 1000000UL;
> f774117c96f94c Jyoti Bhayana 2021-03-09 @247    do_div(*uhz, interval_ns);

Indeed, most do_div() use in that driver is broken on 32-bit.

> f774117c96f94c Jyoti Bhayana 2021-03-09  248  }
> f774117c96f94c Jyoti Bhayana 2021-03-09  249
>
> :::::: The code at line 247 was first introduced by commit
> :::::: f774117c96f94c7c4d2f076e4cacc80218b0df48 iio/scmi: Adding support for IIO SCMI Based Sensors
>
> :::::: TO: Jyoti Bhayana <jbhayana@google.com>
> :::::: CC: Jonathan Cameron <Jonathan.Cameron@huawei.com>

So why was this sent to different people instead?

Gr{oetje,eeting}s,

                        Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-04  7:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-03 18:33 drivers/iio/common/scmi_sensors/scmi_iio.c:247:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead kernel test robot
2026-06-04  7:16 ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®