Skip to content

Commit

Permalink
PM-wakeup: Delete unnecessary checks before three function calls
Browse files Browse the repository at this point in the history
The following functions test whether their argument is NULL
and then return immediately.
 * dev_pm_arm_wake_irq
 * dev_pm_disarm_wake_irq
 * wakeup_source_unregister

Thus the test around the calls is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Pavel Machek <pavel@ucw.cz>
[ rjw: Minor whitespace adjustments ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Markus Elfring authored and Rafael J. Wysocki committed Jul 28, 2016
1 parent fe7450b commit 4f48ec8
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions drivers/base/power/wakeup.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,9 @@ void device_wakeup_arm_wake_irqs(void)
struct wakeup_source *ws;

rcu_read_lock();
list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
if (ws->wakeirq)
dev_pm_arm_wake_irq(ws->wakeirq);
}
list_for_each_entry_rcu(ws, &wakeup_sources, entry)
dev_pm_arm_wake_irq(ws->wakeirq);

rcu_read_unlock();
}

Expand All @@ -351,10 +350,9 @@ void device_wakeup_disarm_wake_irqs(void)
struct wakeup_source *ws;

rcu_read_lock();
list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
if (ws->wakeirq)
dev_pm_disarm_wake_irq(ws->wakeirq);
}
list_for_each_entry_rcu(ws, &wakeup_sources, entry)
dev_pm_disarm_wake_irq(ws->wakeirq);

rcu_read_unlock();
}

Expand Down Expand Up @@ -390,9 +388,7 @@ int device_wakeup_disable(struct device *dev)
return -EINVAL;

ws = device_wakeup_detach(dev);
if (ws)
wakeup_source_unregister(ws);

wakeup_source_unregister(ws);
return 0;
}
EXPORT_SYMBOL_GPL(device_wakeup_disable);
Expand Down

0 comments on commit 4f48ec8

Please sign in to comment.