Re: [PATCH v3 net-next 06/15] ptp: netc: add periodic pulse output support

kernel test robot
2025-08-13T02:37:23Z

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-7-wei.fang%40nxp.com
patch subject: [PATCH v3 net-next 06/15] ptp: netc: add periodic pulse output support
config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20250813/202508131027.y3pyBEJQ-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 3769ce013be2879bf0b329c14a16f5cb766f26ce)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250813/202508131027.y3pyBEJQ-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/202508131027.y3pyBEJQ-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/ptp/ptp_netc.c:394:33: warning: variable 'pp' is uninitialized when used here [-Wuninitialized]
394 | priv->fs_alarm_bitmap &= ~BIT(pp->alarm_id);
| ^~
drivers/ptp/ptp_netc.c:348:20: note: initialize the variable 'pp' to silence this warning
348 | struct netc_pp *pp;
| ^
| = NULL
1 warning generated.

vim +/pp +394 drivers/ptp/ptp_netc.c

337
338 /* Note that users should not use this API to output PPS signal on
339 * external pins, because PTP_CLK_REQ_PPS trigger internal PPS event
340 * for input into kernel PPS subsystem. See:
341 * https://lore.kernel.org/r/20201117213826.18235-1-a.fatoum@pengutronix.de
342 */
343 static int netc_timer_enable_pps(struct netc_timer *priv,
344 struct ptp_clock_request *rq, int on)
345 {
346 struct device *dev = &priv->pdev->dev;
347 unsigned long flags;
348 struct netc_pp *pp;
349 int err = 0;
350
351 spin_lock_irqsave(&priv->lock, flags);
352
353 if (on) {
354 int alarm_id;
355 u8 channel;
356
357 if (priv->pps_channel < NETC_TMR_FIPER_NUM) {
358 channel = priv->pps_channel;
359 } else {
360 channel = netc_timer_select_pps_channel(priv);
361 if (channel == NETC_TMR_INVALID_CHANNEL) {
362 dev_err(dev, "No available FIPERs\n");
363 err = -EBUSY;
364 goto unlock_spinlock;
365 }
366 }
367
368 pp = &priv->pp[channel];
369 if (pp->enabled)
370 goto unlock_spinlock;
371
372 alarm_id = netc_timer_get_alarm_id(priv);
373 if (alarm_id == priv->fs_alarm_num) {
374 dev_err(dev, "No available ALARMs\n");
375 err = -EBUSY;
376 goto unlock_spinlock;
377 }
378
379 pp->enabled = true;
380 pp->type = NETC_PP_PPS;
381 pp->alarm_id = alarm_id;
382 pp->period = NSEC_PER_SEC;
383 priv->pps_channel = channel;
384
385 netc_timer_enable_periodic_pulse(priv, channel);
386 } else {
387 /* pps_channel is invalid if PPS is not enabled, so no
388 * processing is needed.
389 */
390 if (priv->pps_channel >= NETC_TMR_FIPER_NUM)
391 goto unlock_spinlock;
392
393 netc_timer_disable_periodic_pulse(priv, priv->pps_channel);
> 394 priv->fs_alarm_bitmap &= ~BIT(pp->alarm_id);
395 pp = &priv->pp[priv->pps_channel];
396 memset(pp, 0, sizeof(*pp));
397 priv->pps_channel = NETC_TMR_INVALID_CHANNEL;
398 }
399
400 unlock_spinlock:
401 spin_unlock_irqrestore(&priv->lock, flags);
402
403 return err;
404 }
405

--
0-DAY CI Kernel Test Service