powercap: idle_inject: Simplify if condition
authorThorsten Blum <thorsten.blum@toblux.com>
Wed, 5 Jun 2024 13:58:42 +0000 (15:58 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 7 Jun 2024 18:57:20 +0000 (20:57 +0200)
The if condition !A || A && B can be simplified to !A || B.

Fixes the following Coccinelle/coccicheck warning reported by
excluded_middle.cocci:

WARNING !A || A && B is equivalent to !A || B

Compile-tested only.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/powercap/idle_inject.c

index e18a2cc4e46a0291a2c7f70f01153d6e6d28a30a..bafc59904ed354f3c14ecbbdef17f34114218577 100644 (file)
@@ -127,7 +127,7 @@ static enum hrtimer_restart idle_inject_timer_fn(struct hrtimer *timer)
        struct idle_inject_device *ii_dev =
                container_of(timer, struct idle_inject_device, timer);
 
-       if (!ii_dev->update || (ii_dev->update && ii_dev->update()))
+       if (!ii_dev->update || ii_dev->update())
                idle_inject_wakeup(ii_dev);
 
        duration_us = READ_ONCE(ii_dev->run_duration_us);