video: backlight: lcd: fix race condition during register
Lee Jones
AppliedQuoted 11 lines · Uwe Kleine-König
From: Uwe Kleine-König <[email protected]>
Once
device_registeris called for a device its attributes might be accessed. As the callbacks of a lcd device's attributes make use of thelcd_ops, the respective member must be setup before callingdevice_register.Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/video/backlight/lcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Quoted 22 lines
drivers/video/backlight/lcd.c +2
-2@@ -226,6 +226,8 @@ struct lcd_device *lcd_device_register(const char *name, struct device *parent,dev_set_name (&new_ld->dev,"%s" , name);dev_set_drvdata (&new_ld->dev, devdata); + new_ld->ops = ops; + rc =device_register (&new_ld->dev);if (rc) {put_device (&new_ld->dev);@@ -238,8 +240,6 @@ struct lcd_device *lcd_device_register(const char *name, struct device *parent,return ERR_PTR (rc); } - new_ld->ops = ops; -return new_ld; }EXPORT_SYMBOL (lcd_device_register);
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog