提交 601e6e3c 编写于 作者: D Dan Carpenter 提交者: David S. Miller

sparc: leon: Fix a retry loop in leon_init_timers()

The original code causes a static checker warning because it has a
continue inside a do { } while (0); loop.  In that context, a continue
and a break are equivalent.  The intent was to go back to the start of
the loop so the continue was a bug.

I've added a retry label at the start and changed the continue to a goto
retry.  Then I removed the do { } while (0) loop and pulled the code in
one indent level.

Fixes: 2791c1a4 ("SPARC/LEON: added support for selecting Timer Core and Timer within core")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b5c32061
...@@ -349,7 +349,8 @@ void __init leon_init_timers(void) ...@@ -349,7 +349,8 @@ void __init leon_init_timers(void)
/* Find GPTIMER Timer Registers base address otherwise bail out. */ /* Find GPTIMER Timer Registers base address otherwise bail out. */
nnp = rootnp; nnp = rootnp;
do {
retry:
np = of_find_node_by_name(nnp, "GAISLER_GPTIMER"); np = of_find_node_by_name(nnp, "GAISLER_GPTIMER");
if (!np) { if (!np) {
np = of_find_node_by_name(nnp, "01_011"); np = of_find_node_by_name(nnp, "01_011");
...@@ -365,7 +366,7 @@ void __init leon_init_timers(void) ...@@ -365,7 +366,7 @@ void __init leon_init_timers(void)
/* Skip this instance, resource already /* Skip this instance, resource already
* allocated by other OS */ * allocated by other OS */
nnp = np; nnp = np;
continue; goto retry;
} }
} }
...@@ -379,7 +380,6 @@ void __init leon_init_timers(void) ...@@ -379,7 +380,6 @@ void __init leon_init_timers(void)
pp = of_find_property(np, "interrupts", &len); pp = of_find_property(np, "interrupts", &len);
if (pp) if (pp)
leon3_gptimer_irq = *(unsigned int *)pp->value; leon3_gptimer_irq = *(unsigned int *)pp->value;
} while (0);
if (!(leon3_gptimer_regs && leon3_irqctrl_regs && leon3_gptimer_irq)) if (!(leon3_gptimer_regs && leon3_irqctrl_regs && leon3_gptimer_irq))
goto bad; goto bad;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册