[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <c73761c5-7150-4f20-9b3e-1da680400250@web.de>
Date: Tue, 26 Dec 2023 22:08:44 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-leds@...r.kernel.org, kernel-janitors@...r.kernel.org,
Lee Jones <lee@...nel.org>, Pavel Machek <pavel@....cz>
Cc: LKML <linux-kernel@...r.kernel.org>, cocci@...ia.fr
Subject: [PATCH] leds: trigger: oneshot: One function call less in
pattern_init() after error detection
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Tue, 26 Dec 2023 22:02:08 +0100
The kfree() function was called in one case by
the pattern_init() function during error handling
even if the passed variable contained a null pointer.
This issue was detected by using the Coccinelle software.
Thus use another label.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/leds/trigger/ledtrig-oneshot.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/leds/trigger/ledtrig-oneshot.c b/drivers/leds/trigger/ledtrig-oneshot.c
index bee3bd452abf..31061ec0afe6 100644
--- a/drivers/leds/trigger/ledtrig-oneshot.c
+++ b/drivers/leds/trigger/ledtrig-oneshot.c
@@ -134,7 +134,7 @@ static void pattern_init(struct led_classdev *led_cdev)
pattern = led_get_default_pattern(led_cdev, &size);
if (!pattern)
- goto out_default;
+ goto out_settings;
if (size != 2) {
dev_warn(led_cdev->dev,
@@ -151,6 +151,7 @@ static void pattern_init(struct led_classdev *led_cdev)
out_default:
kfree(pattern);
+out_settings:
led_cdev->blink_delay_on = DEFAULT_DELAY;
led_cdev->blink_delay_off = DEFAULT_DELAY;
}
--
2.43.0
Powered by blists - more mailing lists