]> git.baikalelectronics.ru Git - kernel.git/commit
leds: lm36274: use platform device as parent of LED
authorMarek Behún <marek.behun@nic.cz>
Sat, 19 Sep 2020 18:03:00 +0000 (20:03 +0200)
committerPavel Machek <pavel@ucw.cz>
Sat, 26 Sep 2020 19:56:43 +0000 (21:56 +0200)
commitde0922f467385f797225a582aa8577c688d7235d
tree29dace6fce53f2f823efe65e18d0ec001e49175e
parent63687b5b04e9f3d007f9796f66049608df9a1a31
leds: lm36274: use platform device as parent of LED

Instead of registering LED under the MFD device, this driver sets the
parent of the LED it is registering to the parent of the MFD device (the
I2C client device).

Because of this we cannot use devres for LED registration, since it can
result in use-after-free, see commit
1ac3b32585d0 ("leds: lm36274: fix use-after-free on unbind").

The only other in-tree driver that also registers under the MFD device
(drivers/regulator/lm363x-regulator.c) sets the parent to the MFD
device.

Set the parent of this LED to the MFD device, instead of the I2C client
device.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Tested-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
drivers/leds/leds-lm36274.c