Skip to content

Commit 3c4e014

Browse files
m-falkowskitmlind
authored andcommitted
ARM: OMAP1: Fix use of possibly uninitialized irq variable
The current control flow of IRQ number assignment to `irq` variable allows a request of IRQ of unspecified value, generating a warning under Clang compilation with omap1_defconfig on linux-next: arch/arm/mach-omap1/pm.c:656:11: warning: variable 'irq' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] else if (cpu_is_omap16xx()) ^~~~~~~~~~~~~~~~~ ./arch/arm/mach-omap1/include/mach/soc.h:123:30: note: expanded from macro 'cpu_is_omap16xx' ^~~~~~~~~~~~~ arch/arm/mach-omap1/pm.c:658:18: note: uninitialized use occurs here if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup", ^~~ arch/arm/mach-omap1/pm.c:656:7: note: remove the 'if' if its condition is always true else if (cpu_is_omap16xx()) ^~~~~~~~~~~~~~~~~~~~~~ arch/arm/mach-omap1/pm.c:611:9: note: initialize the variable 'irq' to silence this warning int irq; ^ = 0 1 warning generated. The patch provides a default value to the `irq` variable along with a validity check. Signed-off-by: Maciej Falkowski <[email protected]> Link: ClangBuiltLinux#1324 Signed-off-by: Tony Lindgren <[email protected]>
1 parent 6efb943 commit 3c4e014

File tree

1 file changed

+7
-3
lines changed
  • arch/arm/mach-omap1

1 file changed

+7
-3
lines changed

arch/arm/mach-omap1/pm.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -655,9 +655,13 @@ static int __init omap_pm_init(void)
655655
irq = INT_7XX_WAKE_UP_REQ;
656656
else if (cpu_is_omap16xx())
657657
irq = INT_1610_WAKE_UP_REQ;
658-
if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup",
659-
NULL))
660-
pr_err("Failed to request irq %d (peripheral wakeup)\n", irq);
658+
else
659+
irq = -1;
660+
661+
if (irq >= 0) {
662+
if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup", NULL))
663+
pr_err("Failed to request irq %d (peripheral wakeup)\n", irq);
664+
}
661665

662666
/* Program new power ramp-up time
663667
* (0 for most boards since we don't lower voltage when in deep sleep)

0 commit comments

Comments
 (0)