Skip to content
Commit c72e455b authored by Manuel Fombuena's avatar Manuel Fombuena Committed by Lee Jones
Browse files

leds: leds-st1202: Fix NULL pointer access on race condition



st1202_dt_init() calls devm_led_classdev_register_ext() before the
internal data structures are properly set up, so the LEDs become visible
to user space while being partially initialized, leading to a window
where trying to access them causes a NULL pointer access.

Move devm_led_classdev_register_ext() from DT initialization
to the end of the probe function when DT and hardware are fully
initialized and ready to interact with user space.

Fixes: 25923037 ("leds: Add LED1202 I2C driver")
Signed-off-by: default avatarManuel Fombuena <fombuena@outlook.com>
Link: https://lore.kernel.org/r/CWLP123MB54732771AC0CE5491B3C84DCC5C32@CWLP123MB5473.GBRP123.PROD.OUTLOOK.COM


Signed-off-by: default avatarLee Jones <lee@kernel.org>
parent 2014c95a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment