Commit 01791ea4 authored by H. Nikolaus Schaller's avatar H. Nikolaus Schaller Committed by sanglipeng
Browse files

leds: tca6507: Fix error handling of using fwnode_property_read_string

stable inclusion
from stable-v5.10.180
commit 795cec288e9c3661caff2b9e28012da9e07ea5e5
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8FC2O

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=795cec288e9c3661caff2b9e28012da9e07ea5e5



--------------------------------

[ Upstream commit c1087c29 ]

Commit 96f52410 ("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: 96f52410 ("leds: tca6507: use fwnode API instead of OF")
Signed-off-by: default avatarH. Nikolaus Schaller <hns@goldelico.com>
Acked-by: default avatarPavel Machek <pavel@ucw.cz>
Reviewed-by: default avatarMarek Behún <kabel@kernel.org>
Signed-off-by: default avatarLee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/cbae7617db83113de726fcc423a805ebaa1bfca6.1680433978.git.hns@goldelico.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 14292dd9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment