Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Markus Elfring and committed by
Rafael J. Wysocki
4f48ec8a fe7450b0

+7 -11
+7 -11
drivers/base/power/wakeup.c
··· 334 334 struct wakeup_source *ws; 335 335 336 336 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 + 341 340 rcu_read_unlock(); 342 341 } 343 342 ··· 350 351 struct wakeup_source *ws; 351 352 352 353 rcu_read_lock(); 353 - list_for_each_entry_rcu(ws, &wakeup_sources, entry) { 354 - if (ws->wakeirq) 355 - dev_pm_disarm_wake_irq(ws->wakeirq); 356 - } 354 + list_for_each_entry_rcu(ws, &wakeup_sources, entry) 355 + dev_pm_disarm_wake_irq(ws->wakeirq); 356 + 357 357 rcu_read_unlock(); 358 358 } 359 359 ··· 388 390 return -EINVAL; 389 391 390 392 ws = device_wakeup_detach(dev); 391 - if (ws) 392 - wakeup_source_unregister(ws); 393 - 393 + wakeup_source_unregister(ws); 394 394 return 0; 395 395 } 396 396 EXPORT_SYMBOL_GPL(device_wakeup_disable);