Skip to content

Commit d6f21ea

Browse files
Uwe Kleine-Königgregkh
authored andcommitted
backlight: lcd: Fix race condition during register
[ Upstream commit cc21942bce652d1a92dae85b785378256e1df1f7 ] Once device_register is called for a device its attributes might be accessed. As the callbacks of a lcd device's attributes make use of the lcd_ops, the respective member must be setup before calling device_register. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent fe21a3d commit d6f21ea

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • drivers/video/backlight

drivers/video/backlight/lcd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ struct lcd_device *lcd_device_register(const char *name, struct device *parent,
226226
dev_set_name(&new_ld->dev, "%s", name);
227227
dev_set_drvdata(&new_ld->dev, devdata);
228228

229+
new_ld->ops = ops;
230+
229231
rc = device_register(&new_ld->dev);
230232
if (rc) {
231233
put_device(&new_ld->dev);
@@ -238,8 +240,6 @@ struct lcd_device *lcd_device_register(const char *name, struct device *parent,
238240
return ERR_PTR(rc);
239241
}
240242

241-
new_ld->ops = ops;
242-
243243
return new_ld;
244244
}
245245
EXPORT_SYMBOL(lcd_device_register);

0 commit comments

Comments
 (0)