summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Vokáč <michal.vokac@ysoft.com>2024-10-17 17:08:12 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-12-09 10:33:05 +0100
commit6aa39a78128a2291aa0dc9fb174817c0c0106e53 (patch)
treeeeae1ec5969f3c6a8a73c17bf3e4819cfb666185
parent3723d1c056d04408acfe13403596b9c5832d364f (diff)
downloadlinux-6aa39a78128a2291aa0dc9fb174817c0c0106e53.tar.gz
linux-6aa39a78128a2291aa0dc9fb174817c0c0106e53.tar.bz2
linux-6aa39a78128a2291aa0dc9fb174817c0c0106e53.zip
leds: lp55xx: Remove redundant test for invalid channel number
commit 09b1ef9813a0742674f7efe26104403ca94a1b4a upstream. Since commit 92a81562e695 ("leds: lp55xx: Add multicolor framework support to lp55xx") there are two subsequent tests if the chan_nr (reg property) is in valid range. One in the lp55xx_init_led() function and one in the lp55xx_parse_common_child() function that was added with the mentioned commit. There are two issues with that. First is in the lp55xx_parse_common_child() function where the reg property is tested right after it is read from the device tree. Test for the upper range is not correct though. Valid reg values are 0 to (max_channel - 1) so it should be >=. Second issue is that in case the parsed value is out of the range the probe just fails and no error message is shown as the code never reaches the second test that prints and error message. Remove the test form lp55xx_parse_common_child() function completely and keep the one in lp55xx_init_led() function to deal with it. Fixes: 92a81562e695 ("leds: lp55xx: Add multicolor framework support to lp55xx") Cc: stable@vger.kernel.org Signed-off-by: Michal Vokáč <michal.vokac@ysoft.com> Link: https://lore.kernel.org/r/20241017150812.3563629-1-michal.vokac@ysoft.com Signed-off-by: Lee Jones <lee@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/leds/leds-lp55xx-common.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c
index 77bb26906ea6..84028800aed3 100644
--- a/drivers/leds/leds-lp55xx-common.c
+++ b/drivers/leds/leds-lp55xx-common.c
@@ -580,9 +580,6 @@ static int lp55xx_parse_common_child(struct device_node *np,
if (ret)
return ret;
- if (*chan_nr < 0 || *chan_nr > cfg->max_channel)
- return -EINVAL;
-
return 0;
}