Re: [PATCH] clocksource/drivers/timer-cadence-ttc: fix a signedness bug in probe()

From: Michal Simek
Date: Tue Jun 06 2023 - 05:26:44 EST




On 6/6/23 10:15, Dan Carpenter wrote:
Make the "irq" variable signed so the error handling can work.

urq_of_parse_and_map returns unsigned type.

include/linux/of_irq.h:118:extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);

instead of this condition should be fixed to

irq = irq_of_parse_and_map(timer, 1);
if (!irq) {
...


Fixes: e932900a3279 ("arm: zynq: Use standard timer binding")
Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
From static analysis. Untested. Presumably if probe fails the system
is unbootable so I didn't bother looking at the resource leaks.

In the way how systems with TTC are used today that's correct assumption.

But just to be accurate system can also have different timers which could be used instead.

Thanks,
Michal