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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 25 Oct 2023 16:07:32 +0300
From:   George Stark <gnstark@...utedevices.com>
To:     <pavel@....cz>, <lee@...nel.org>, <vadimp@...dia.com>,
        <mpe@...erman.id.au>, <npiggin@...il.com>,
        <christophe.leroy@...roup.eu>, <gnstark@...utedevices.com>
CC:     <linux-leds@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linuxppc-dev@...ts.ozlabs.org>, <kernel@...rdevices.ru>
Subject: [PATCH 3/8] leds: an30259a: explicitly unregister LEDs at module's shutdown

LEDs are registered using devm_led_classdev_register() and automatically
unregistered after module's remove(). led_classdev_unregister() calls
led_set_brightness() to turn off the LEDs and module's appropriate callback
uses resources those were destroyed already in module's remove().
So explicitly unregister LEDs at module shutdown.

Signed-off-by: George Stark <gnstark@...utedevices.com>
---
 drivers/leds/leds-an30259a.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/leds/leds-an30259a.c b/drivers/leds/leds-an30259a.c
index 24b1041213c2..4209a407d802 100644
--- a/drivers/leds/leds-an30259a.c
+++ b/drivers/leds/leds-an30259a.c
@@ -324,6 +324,10 @@ static int an30259a_probe(struct i2c_client *client)
 static void an30259a_remove(struct i2c_client *client)
 {
 	struct an30259a *chip = i2c_get_clientdata(client);
+	int i;
+
+	for (i = 0; i < chip->num_leds; i++)
+		devm_led_classdev_unregister(&client->dev, &chip->leds[i].cdev);
 
 	mutex_destroy(&chip->mutex);
 }
-- 
2.38.4

Powered by blists - more mailing lists