diff mbox series

ARM: omap1: fix irq setup

Message ID 20200505141400.767312-1-arnd@arndb.de (mailing list archive)
State New, archived
Headers show
Series ARM: omap1: fix irq setup | expand

Commit Message

Arnd Bergmann May 5, 2020, 2:13 p.m. UTC
A recent cleanup introduced a bug on any omap1 machine that has
no wakeup IRQ, i.e. omap15xx:

arch/arm/mach-omap1/pm.c:656:11: error: variable 'irq' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
        else if (cpu_is_omap16xx())
                 ^~~~~~~~~~~~~~~~~
include/linux/soc/ti/omap1-soc.h:115:30: note: expanded from macro 'cpu_is_omap16xx'
 #  define cpu_is_omap16xx()             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;
               ^

Move this code into a separate function to deal with it cleanly.

Fixes: b75ca5217743 ("ARM: OMAP: replace setup_irq() by request_irq()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-omap1/pm.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

Comments

afzal mohammed May 5, 2020, 2:30 p.m. UTC | #1
Hi,

On Tue, May 05, 2020 at 04:13:48PM +0200, Arnd Bergmann wrote:

> A recent cleanup introduced a bug on any omap1 machine that has
> no wakeup IRQ, i.e. omap15xx:

> Move this code into a separate function to deal with it cleanly.
> 
> Fixes: b75ca5217743 ("ARM: OMAP: replace setup_irq() by request_irq()")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Sorry for the mistake and thanks for the fix,

Acked-by: afzal mohammed <afzal.mohd.ma@gmail.com>

Regards
afzal
Tony Lindgren May 5, 2020, 3:39 p.m. UTC | #2
* afzal mohammed <afzal.mohd.ma@gmail.com> [200505 14:31]:
> Hi,
> 
> On Tue, May 05, 2020 at 04:13:48PM +0200, Arnd Bergmann wrote:
> 
> > A recent cleanup introduced a bug on any omap1 machine that has
> > no wakeup IRQ, i.e. omap15xx:
> 
> > Move this code into a separate function to deal with it cleanly.
> > 
> > Fixes: b75ca5217743 ("ARM: OMAP: replace setup_irq() by request_irq()")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Sorry for the mistake and thanks for the fix,
> 
> Acked-by: afzal mohammed <afzal.mohd.ma@gmail.com>

Acked-by: Tony Lindgren <tony@atomide.com>
Tony Lindgren June 16, 2020, 3:58 p.m. UTC | #3
* afzal mohammed <afzal.mohd.ma@gmail.com> [200505 14:31]:
> Hi,
> 
> On Tue, May 05, 2020 at 04:13:48PM +0200, Arnd Bergmann wrote:
> 
> > A recent cleanup introduced a bug on any omap1 machine that has
> > no wakeup IRQ, i.e. omap15xx:
> 
> > Move this code into a separate function to deal with it cleanly.
> > 
> > Fixes: b75ca5217743 ("ARM: OMAP: replace setup_irq() by request_irq()")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Sorry for the mistake and thanks for the fix,
> 
> Acked-by: afzal mohammed <afzal.mohd.ma@gmail.com>

Hmm so is this one still pending?

Best that Arnd applies it directly:

Acked-by: Tony Lindgren <tony@atomide.com>
diff mbox series

Patch

diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 0f8064bd40ae..266aa08aa8ed 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -605,10 +605,25 @@  static const struct platform_suspend_ops omap_pm_ops = {
 	.valid		= suspend_valid_only_mem,
 };
 
+static void omap_wakeup_init(void)
+{
+	int irq;
+
+	if (cpu_is_omap7xx())
+		irq = INT_7XX_WAKE_UP_REQ;
+	else if (cpu_is_omap16xx())
+		irq = INT_1610_WAKE_UP_REQ;
+	else
+		return;
+
+	if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup",
+			NULL))
+		pr_err("Failed to request irq %d (peripheral wakeup)\n", irq);
+}
+
 static int __init omap_pm_init(void)
 {
 	int error = 0;
-	int irq;
 
 	if (!cpu_class_is_omap1())
 		return -ENODEV;
@@ -651,13 +666,7 @@  static int __init omap_pm_init(void)
 
 	arm_pm_idle = omap1_pm_idle;
 
-	if (cpu_is_omap7xx())
-		irq = INT_7XX_WAKE_UP_REQ;
-	else if (cpu_is_omap16xx())
-		irq = INT_1610_WAKE_UP_REQ;
-	if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup",
-			NULL))
-		pr_err("Failed to request irq %d (peripheral wakeup)\n", irq);
+	omap_wakeup_init();
 
 	/* Program new power ramp-up time
 	 * (0 for most boards since we don't lower voltage when in deep sleep)