diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2016-11-25 06:25:54 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-12-11 21:15:49 -0500 |
commit | 601e6e3cc5bf6adb7d076fe24d10f6191a25ba9b (patch) | |
tree | 54a81af42d88f143cf316388e3ed80522440b886 | |
parent | b5c3206190f1fddd100b3060eb15f0d775ffeab8 (diff) |
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: 2791c1a43900 ("SPARC/LEON: added support for selecting Timer Core and Timer within core")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/sparc/kernel/leon_kernel.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c index 33cd171d933e..afcdd5e4f43f 100644 --- a/arch/sparc/kernel/leon_kernel.c +++ b/arch/sparc/kernel/leon_kernel.c | |||
@@ -349,37 +349,37 @@ void __init leon_init_timers(void) | |||
349 | 349 | ||
350 | /* Find GPTIMER Timer Registers base address otherwise bail out. */ | 350 | /* Find GPTIMER Timer Registers base address otherwise bail out. */ |
351 | nnp = rootnp; | 351 | nnp = rootnp; |
352 | do { | ||
353 | np = of_find_node_by_name(nnp, "GAISLER_GPTIMER"); | ||
354 | if (!np) { | ||
355 | np = of_find_node_by_name(nnp, "01_011"); | ||
356 | if (!np) | ||
357 | goto bad; | ||
358 | } | ||
359 | 352 | ||
360 | ampopts = 0; | 353 | retry: |
361 | pp = of_find_property(np, "ampopts", &len); | 354 | np = of_find_node_by_name(nnp, "GAISLER_GPTIMER"); |
362 | if (pp) { | 355 | if (!np) { |
363 | ampopts = *(int *)pp->value; | 356 | np = of_find_node_by_name(nnp, "01_011"); |
364 | if (ampopts == 0) { | 357 | if (!np) |
365 | /* Skip this instance, resource already | 358 | goto bad; |
366 | * allocated by other OS */ | 359 | } |
367 | nnp = np; | 360 | |
368 | continue; | 361 | ampopts = 0; |
369 | } | 362 | pp = of_find_property(np, "ampopts", &len); |
363 | if (pp) { | ||
364 | ampopts = *(int *)pp->value; | ||
365 | if (ampopts == 0) { | ||
366 | /* Skip this instance, resource already | ||
367 | * allocated by other OS */ | ||
368 | nnp = np; | ||
369 | goto retry; | ||
370 | } | 370 | } |
371 | } | ||
372 | |||
373 | /* Select Timer-Instance on Timer Core. Default is zero */ | ||
374 | leon3_gptimer_idx = ampopts & 0x7; | ||
371 | 375 | ||
372 | /* Select Timer-Instance on Timer Core. Default is zero */ | 376 | pp = of_find_property(np, "reg", &len); |
373 | leon3_gptimer_idx = ampopts & 0x7; | 377 | if (pp) |
374 | 378 | leon3_gptimer_regs = *(struct leon3_gptimer_regs_map **) | |
375 | pp = of_find_property(np, "reg", &len); | 379 | pp->value; |
376 | if (pp) | 380 | pp = of_find_property(np, "interrupts", &len); |
377 | leon3_gptimer_regs = *(struct leon3_gptimer_regs_map **) | 381 | if (pp) |
378 | pp->value; | 382 | leon3_gptimer_irq = *(unsigned int *)pp->value; |
379 | pp = of_find_property(np, "interrupts", &len); | ||
380 | if (pp) | ||
381 | leon3_gptimer_irq = *(unsigned int *)pp->value; | ||
382 | } while (0); | ||
383 | 383 | ||
384 | if (!(leon3_gptimer_regs && leon3_irqctrl_regs && leon3_gptimer_irq)) | 384 | if (!(leon3_gptimer_regs && leon3_irqctrl_regs && leon3_gptimer_irq)) |
385 | goto bad; | 385 | goto bad; |