Commit 5c3faad2 authored by Frans Klaver's avatar Frans Klaver Committed by Sebastian Reichel

power: reset: ltc2952: cleanup control flow in poweroff_handler

ltc2952_poweroff_handler uses gotos to return from the function. Since
we don't do cleanups exiting this function, just return IRQ_HANDLED on
the spot and be done with it.

While at it, remove the variable 'ret'. It was never used very much.
Signed-off-by: default avatarFrans Klaver <frans.klaver@xsens.com>
Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
parent 0428c40d
...@@ -153,29 +153,21 @@ ltc2952_poweroff_timer_trigger(struct hrtimer *timer) ...@@ -153,29 +153,21 @@ ltc2952_poweroff_timer_trigger(struct hrtimer *timer)
*/ */
static irqreturn_t ltc2952_poweroff_handler(int irq, void *dev_id) static irqreturn_t ltc2952_poweroff_handler(int irq, void *dev_id)
{ {
int ret;
struct ltc2952_poweroff *data = dev_id; struct ltc2952_poweroff *data = dev_id;
if (data->kernel_panic) if (data->kernel_panic || hrtimer_active(&data->timer_wde)) {
goto irq_ok;
if (hrtimer_active(&data->timer_wde)) {
/* shutdown is already triggered, nothing to do any more */ /* shutdown is already triggered, nothing to do any more */
goto irq_ok; return IRQ_HANDLED;
} }
if (!hrtimer_active(&data->timer_trigger)) { if (!hrtimer_active(&data->timer_trigger)) {
ret = hrtimer_start(&data->timer_trigger, data->trigger_delay, if (hrtimer_start(&data->timer_trigger, data->trigger_delay,
HRTIMER_MODE_REL); HRTIMER_MODE_REL))
if (ret)
dev_err(data->dev, "unable to start the wait timer\n"); dev_err(data->dev, "unable to start the wait timer\n");
} else { } else {
ret = hrtimer_cancel(&data->timer_trigger); hrtimer_cancel(&data->timer_trigger);
/* omitting return value check, timer should have been valid */ /* omitting return value check, timer should have been valid */
} }
irq_ok:
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment