aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/led-class.c
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2024-05-26 20:17:15 +0200
committerLee Jones <lee@kernel.org>2024-06-14 10:09:34 +0100
commitbfefbecdeadc608c625e85259ad0a89d34728d61 (patch)
tree93eabddace96b940722dc2b5d1fa031a9cfadec7 /drivers/leds/led-class.c
parentLinux 6.10-rc1 (diff)
downloadlinux-bfefbecdeadc608c625e85259ad0a89d34728d61.tar.gz
linux-bfefbecdeadc608c625e85259ad0a89d34728d61.zip
leds: class: Warn about name collisions earlier
Other warnings refer to the name after renaming, which is clearer when that name is mentioned first. It is also clearer where "ret" comes from. While at it, also add the necessary newline to the message and fix the parameter alignment. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20240526-cros_ec-kbd-led-framework-v3-1-ee577415a521@weissschuh.net Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'drivers/leds/led-class.c')
-rw-r--r--drivers/leds/led-class.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 24fcff682b24..c298355d5b7d 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -503,6 +503,9 @@ int led_classdev_register_ext(struct device *parent,
ret = led_classdev_next_name(proposed_name, final_name, sizeof(final_name));
if (ret < 0)
return ret;
+ else if (ret)
+ dev_warn(parent, "Led %s renamed to %s due to name collision\n",
+ proposed_name, final_name);
if (led_cdev->color >= LED_COLOR_ID_MAX)
dev_warn(parent, "LED %s color identifier out of range\n", final_name);
@@ -518,10 +521,6 @@ int led_classdev_register_ext(struct device *parent,
if (init_data && init_data->fwnode)
device_set_node(led_cdev->dev, init_data->fwnode);
- if (ret)
- dev_warn(parent, "Led %s renamed to %s due to name collision",
- proposed_name, dev_name(led_cdev->dev));
-
if (led_cdev->flags & LED_BRIGHT_HW_CHANGED) {
ret = led_add_brightness_hw_changed(led_cdev);
if (ret) {