Skip to contentSkip to conversation

kernel/time/timer_migration.c:1529:6-9: WARNING: Unsigned expression compared with zero: ret < 0 (fwd)

PATCH In review Julia Lawall 2 participants 2 messages Dec 10, 2023 – Dec 11, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 30/32 kernel/time/timer_migration.c:1529:6-9: WARNING: Unsigned expression compared with zero: ret < 0 (fwd)

---------- Forwarded message ----------
Date: Sun, 10 Dec 2023 22:29:05 +0800
From: kernel test robot <[email protected]>
To: [email protected]
Cc: [email protected], Julia Lawall <[email protected]>
Subject: [tglx-devel:timers/pushpull 30/32]
kernel/time/timer_migration.c:1529:6-9: WARNING: Unsigned expression
compared with zero: ret < 0

BCC: [email protected]
CC: [email protected]
TO: "Anna-Maria Behnsen" <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git timers/pushpull
head:   c5f729902c462bd2f9153641aebe042bbb5f9ede
commit: f7012466efc3b7e5a3220e702ada7e51245caf20 [30/32] timers: Implement the hierarchical pull model

:::::: branch date: 9 days ago
:::::: commit date: 9 days ago
config: x86_64-randconfig-101-20231210 (https://download.01.org/0day-ci/archive/20231210/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231210/[email protected]/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 <[email protected]>
| Reported-by: Julia Lawall <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

cocci warnings: (new ones prefixed by >>)

Quoted 1 line
Quoted 1 line

kernel/time/timer_migration.c:1529:6-9: WARNING: Unsigned expression compared with zero: ret < 0

vim +1529 kernel/time/timer_migration.c

f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1518
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1519  static int tmigr_cpu_online(unsigned int cpu)
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1520  {
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1521  	struct tmigr_cpu *tmc = this_cpu_ptr(&tmigr_cpu);
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1522  	unsigned int ret;
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1523
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1524  	/* First online attempt? Initialize CPU data */
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1525  	if (!tmc->tmgroup) {
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1526  		raw_spin_lock_init(&tmc->lock);
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1527
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1528  		ret = tmigr_add_cpu(cpu);
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21 @1529  		if (ret < 0)
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1530  			return ret;
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1531
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1532  		if (tmc->childmask == 0)
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1533  			return -EINVAL;
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1534
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1535  		timerqueue_init(&tmc->cpuevt.nextevt);
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1536  		tmc->cpuevt.nextevt.expires = KTIME_MAX;
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1537  		tmc->cpuevt.ignore = true;
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1538  		tmc->cpuevt.cpu = cpu;
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1539
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1540  		tmc->remote = false;
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1541  		WRITE_ONCE(tmc->wakeup, KTIME_MAX);
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1542  	}
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1543  	raw_spin_lock_irq(&tmc->lock);
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1544  	if (timer_base_is_idle())
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1545  		tmc->idle = true;
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1546  	else
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1547  		__tmigr_cpu_activate(tmc);
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1548  	tmc->online = true;
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1549  	raw_spin_unlock_irq(&tmc->lock);
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1550  	return 0;
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1551  }
f7012466efc3b7 Anna-Maria Behnsen 2019-03-21  1552
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw

Hi Julia,

Quoted 9 lines · Julia Lawall

---------- Forwarded message ----------
Date: Sun, 10 Dec 2023 22:29:05 +0800
From: kernel test robot <[email protected]>
To: [email protected]
Cc: [email protected], Julia Lawall <[email protected]>
Subject: [tglx-devel:timers/pushpull 30/32]
kernel/time/timer_migration.c:1529:6-9: WARNING: Unsigned expression
compared with zero: ret < 0

Thanks for forwarding. I already recieved this report on 6th of december and will fix it in the next version.

Thanks,

Anna-Maria