aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorMarek BehĂșn <marek.behun@nic.cz>2020-09-19 20:03:01 +0200
committerPavel Machek <pavel@ucw.cz>2020-09-26 21:56:43 +0200
commit60bbd9d411e32328dbecaff9ec5dfab29b546aba (patch)
treee1420c97336427a8bebc266b08655d8731887775 /drivers/leds
parentleds: lm36274: use platform device as parent of LED (diff)
downloadlinux-dev-60bbd9d411e32328dbecaff9ec5dfab29b546aba.tar.xz
linux-dev-60bbd9d411e32328dbecaff9ec5dfab29b546aba.zip
leds: lm36274: use devres LED registering function
Now that the potential use-after-free issue is resolved we can use devres for LED registration in this driver. By using devres version of LED registering function we can remove the .remove method from this driver. 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>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-lm36274.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/leds/leds-lm36274.c b/drivers/leds/leds-lm36274.c
index 74c236d1a60c..10a63b7f2ecc 100644
--- a/drivers/leds/leds-lm36274.c
+++ b/drivers/leds/leds-lm36274.c
@@ -142,7 +142,8 @@ static int lm36274_probe(struct platform_device *pdev)
chip->led_dev.max_brightness = MAX_BRIGHTNESS_11BIT;
chip->led_dev.brightness_set_blocking = lm36274_brightness_set;
- ret = led_classdev_register_ext(chip->dev, &chip->led_dev, &init_data);
+ ret = devm_led_classdev_register_ext(chip->dev, &chip->led_dev,
+ &init_data);
if (ret)
dev_err(chip->dev, "Failed to register LED for node %pfw\n",
init_data.fwnode);
@@ -152,15 +153,6 @@ static int lm36274_probe(struct platform_device *pdev)
return ret;
}
-static int lm36274_remove(struct platform_device *pdev)
-{
- struct lm36274 *chip = platform_get_drvdata(pdev);
-
- led_classdev_unregister(&chip->led_dev);
-
- return 0;
-}
-
static const struct of_device_id of_lm36274_leds_match[] = {
{ .compatible = "ti,lm36274-backlight", },
{},
@@ -169,7 +161,6 @@ MODULE_DEVICE_TABLE(of, of_lm36274_leds_match);
static struct platform_driver lm36274_driver = {
.probe = lm36274_probe,
- .remove = lm36274_remove,
.driver = {
.name = "lm36274-leds",
},