Skip to content

Commit c0c4579

Browse files
arndbdlezcano
authored andcommitted
clocksource/drivers/ep93xx: Fix error handling during probe
When the interrupt property fails to be parsed, ep93xx_timer_of_init() return code ends up uninitialized: drivers/clocksource/timer-ep93xx.c:160:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] if (irq < 0) { ^~~~~~~ drivers/clocksource/timer-ep93xx.c:188:9: note: uninitialized use occurs here return ret; ^~~ drivers/clocksource/timer-ep93xx.c:160:2: note: remove the 'if' if its condition is always false if (irq < 0) { ^~~~~~~~~~~~~~ Simplify this portion to use the normal construct of just checking whether a valid interrupt was returned. Note that irq_of_parse_and_map() never returns a negative value and no other callers check for that either. Fixes: c28ca80 ("clocksource: ep93xx: Add driver for Cirrus Logic EP93xx") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0515c73 commit c0c4579

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/clocksource/timer-ep93xx.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,8 @@ static int __init ep93xx_timer_of_init(struct device_node *np)
155155
ep93xx_tcu = tcu;
156156

157157
irq = irq_of_parse_and_map(np, 0);
158-
if (irq == 0)
159-
irq = -EINVAL;
160-
if (irq < 0) {
158+
if (!irq) {
159+
ret = -EINVAL;
161160
pr_err("EP93XX Timer Can't parse IRQ %d", irq);
162161
goto out_free;
163162
}

0 commit comments

Comments
 (0)