Skip to content

Commit 4f48ec8

Browse files
elfringrafaeljw
authored andcommitted
PM-wakeup: Delete unnecessary checks before three function calls
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>
1 parent fe7450b commit 4f48ec8

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

drivers/base/power/wakeup.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,9 @@ void device_wakeup_arm_wake_irqs(void)
334334
struct wakeup_source *ws;
335335

336336
rcu_read_lock();
337-
list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
338-
if (ws->wakeirq)
339-
dev_pm_arm_wake_irq(ws->wakeirq);
340-
}
337+
list_for_each_entry_rcu(ws, &wakeup_sources, entry)
338+
dev_pm_arm_wake_irq(ws->wakeirq);
339+
341340
rcu_read_unlock();
342341
}
343342

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

353352
rcu_read_lock();
354-
list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
355-
if (ws->wakeirq)
356-
dev_pm_disarm_wake_irq(ws->wakeirq);
357-
}
353+
list_for_each_entry_rcu(ws, &wakeup_sources, entry)
354+
dev_pm_disarm_wake_irq(ws->wakeirq);
355+
358356
rcu_read_unlock();
359357
}
360358

@@ -390,9 +388,7 @@ int device_wakeup_disable(struct device *dev)
390388
return -EINVAL;
391389

392390
ws = device_wakeup_detach(dev);
393-
if (ws)
394-
wakeup_source_unregister(ws);
395-
391+
wakeup_source_unregister(ws);
396392
return 0;
397393
}
398394
EXPORT_SYMBOL_GPL(device_wakeup_disable);

0 commit comments

Comments
 (0)