From: "Michal Vokáč" <michal.vokac@ysoft.com>
To: kernel test robot <lkp@intel.com>, Pavel Machek <pavel@ucw.cz>,
Lee Jones <lee@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev, Dan Murphy <dmurphy@ti.com>,
Jacek Anaszewski <jacek.anaszewski@gmail.com>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] leds: lp55xx: Fix check for invalid channel number
Date: Thu, 10 Oct 2024 09:16:40 +0200 [thread overview]
Message-ID: <01486eac-b059-48be-a012-24166085bc7e@ysoft.com> (raw)
In-Reply-To: <202410101313.hQc9I8AL-lkp@intel.com>
On 10. 10. 24 8:00, kernel test robot wrote:
> vim +1130 drivers/leds/leds-lp55xx-common.c
>
> 1111
> 1112 static int lp55xx_parse_common_child(struct device_node *np,
> 1113 struct lp55xx_led_config *cfg,
> 1114 int led_number, int *chan_nr)
> 1115 {
> 1116 int ret;
> 1117
> 1118 of_property_read_string(np, "chan-name",
> 1119 &cfg[led_number].name);
> 1120 of_property_read_u8(np, "led-cur",
> 1121 &cfg[led_number].led_current);
> 1122 of_property_read_u8(np, "max-cur",
> 1123 &cfg[led_number].max_current);
> 1124
> 1125 ret = of_property_read_u32(np, "reg", chan_nr);
> 1126 if (ret)
> 1127 return ret;
> 1128
> 1129 if (*chan_nr < 0 || *chan_nr >= cfg->max_channel) {
>> 1130 dev_err(dev, "Use channel numbers between 0 and %d\n",
Ahh, rookie mistake. Of course the dev is not available here. I feel dumb
as I think I at least compile tested this..
Anyway, the comparison is wrong and I still think it is not nice to
the user/DT developer to quietly fail here. I suggest to remove this
check here completely and keep the one in the lp55xx_init_led().
Michal
> 1131 cfg->max_channel - 1);
> 1132 return -EINVAL;
> 1133 }
> 1134
> 1135 return 0;
> 1136 }
> 1137
>
prev parent reply other threads:[~2024-10-10 7:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 9:02 [PATCH] leds: lp55xx: Fix check for invalid channel number Michal Vokáč
2024-10-09 9:56 ` Michal Vokáč
2024-10-10 6:00 ` kernel test robot
2024-10-10 7:16 ` Michal Vokáč [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=01486eac-b059-48be-a012-24166085bc7e@ysoft.com \
--to=michal.vokac@ysoft.com \
--cc=dmurphy@ti.com \
--cc=jacek.anaszewski@gmail.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=pavel@ucw.cz \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox