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

Michal Simek michal.simek at amd.com
Tue Jun 6 02:26:20 PDT 2023



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 at oracle.com>
> ---
>  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



More information about the linux-arm-kernel mailing list