lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1473844987-21112-1-git-send-email-daro@hms.se>
Date:   Wed, 14 Sep 2016 11:23:07 +0200
From:   Daniel Romell <danielromell@...il.com>
To:     rpurdie@...ys.net, j.anaszewski@...sung.com
Cc:     linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org,
        Daniel Romell <daro@....se>
Subject: [PATCH] leds: Only remove trigger if one is actually configured.

In led_trigger_remove(), check if there is a trigger
configured before calling led_trigger_set(). This will
prevent some unnecessary work, and more importantly stop
sending uevent change events when no change has in fact
occurred.

Signed-off-by: Daniel Romell <daro@....se>
---
 drivers/leds/led-triggers.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 59d6a3e..28c7a66 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -147,7 +147,8 @@ EXPORT_SYMBOL_GPL(led_trigger_set);
 void led_trigger_remove(struct led_classdev *led_cdev)
 {
 	down_write(&led_cdev->trigger_lock);
-	led_trigger_set(led_cdev, NULL);
+	if (led_cdev->trigger)
+		led_trigger_set(led_cdev, NULL);
 	up_write(&led_cdev->trigger_lock);
 }
 EXPORT_SYMBOL_GPL(led_trigger_remove);
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ