Re: [PATCH v3 net-next 04/15] ptp: netc: add NETC V4 Timer PTP driver support

kernel test robot
2025-08-13T04:46:15Z

Hi Wei,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url: https://github.com/intel-lab-lkp/linux/commits/Wei-Fang/dt-bindings-ptp-add-NETC-Timer-PTP-clock/20250812-181510
base: net-next/main
patch link: https://lore.kernel.org/r/20250812094634.489901-5-wei.fang%40nxp.com
patch subject: [PATCH v3 net-next 04/15] ptp: netc: add NETC V4 Timer PTP driver support
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20250813/202508131032.BQJ5m6ky-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250813/202508131032.BQJ5m6ky-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/202508131032.BQJ5m6ky-lkp@intel.com/

All warnings (new ones prefixed by >>):

drivers/ptp/ptp_netc.c: In function 'netc_timer_get_reference_clk_source':
>> drivers/ptp/ptp_netc.c:365:45: warning: left shift count >= width of type [-Wshift-count-overflow]
365 | priv->period = div_u64(NSEC_PER_SEC << 32, priv->clk_freq);
| ^~

vim +365 drivers/ptp/ptp_netc.c

333
334 static int netc_timer_get_reference_clk_source(struct netc_timer *priv)
335 {
336 struct device *dev = &priv->pdev->dev;
337 struct clk *clk;
338 int i;
339
340 /* Select NETC system clock as the reference clock by default */
341 priv->clk_select = NETC_TMR_SYSTEM_CLK;
342 priv->clk_freq = NETC_TMR_SYSCLK_333M;
343
344 /* Update the clock source of the reference clock if the clock
345 * is specified in DT node.
346 */
347 for (i = 0; i < ARRAY_SIZE(timer_clk_src); i++) {
348 clk = devm_clk_get_optional_enabled(dev, timer_clk_src[i]);
349 if (IS_ERR(clk))
350 return PTR_ERR(clk);
351
352 if (clk) {
353 priv->clk_freq = clk_get_rate(clk);
354 priv->clk_select = i ? NETC_TMR_EXT_OSC :
355 NETC_TMR_CCM_TIMER1;
356 break;
357 }
358 }
359
360 /* The period is a 64-bit number, the high 32-bit is the integer
361 * part of the period, the low 32-bit is the fractional part of
362 * the period. In order to get the desired 32-bit fixed-point
363 * format, multiply the numerator of the fraction by 2^32.
364 */
> 365 priv->period = div_u64(NSEC_PER_SEC << 32, priv->clk_freq);
366
367 return 0;
368 }
369

--
0-DAY CI Kernel Test Service