[Letux-kernel] [PATCH] leds: tca6507: fix error handling of using fwnode_property_read_string

Lee Jones lee at kernel.org
Wed Apr 5 17:29:08 CEST 2023

On Sun, 02 Apr 2023, H. Nikolaus Schaller wrote:

> Commit 96f524105b9c ("leds: tca6507: use fwnode API instead of OF")
> changed to fwnode API but did not take into account that a missing property
> "linux,default-trigger" now seems to return an error and as a side effect
> sets value to -1. This seems to be different from of_get_property() which
> always returned NULL in any case of error.
> Neglecting this side-effect leads to
> [   11.201965] Unable to handle kernel paging request at virtual address ffffffff when read
> in the strcmp() of led_trigger_set_default() if there is no led-trigger
> defined in the DTS.
> I don't know if this was recently introduced somewhere in the fwnode lib
> or if the effect was missed in initial testing. Anyways it seems to be a
> bug to ignore the error return value of an optional value here in the
> driver.
> Fixes: 96f524105b9c ("leds: tca6507: use fwnode API instead of OF")
> Cc: Marek Behún <kabel at kernel.org>
> Cc: NeilBrown <neilb at suse.de>
> Cc: Linus Walleij <linus.walleij at linaro.org>
> Signed-off-by: H. Nikolaus Schaller <hns at goldelico.com>
> ---
>  drivers/leds/leds-tca6507.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Applied, thanks

Lee Jones [李琼斯]

More information about the Letux-kernel mailing list