Commit 60bbd9d4 authored by Marek Behún's avatar Marek Behún Committed by Pavel Machek

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: default avatarMarek Behún <marek.behun@nic.cz>
Tested-by: default avatarDan Murphy <dmurphy@ti.com>
Signed-off-by: default avatarPavel Machek <pavel@ucw.cz>
parent 5c0d20a9
...@@ -142,7 +142,8 @@ static int lm36274_probe(struct platform_device *pdev) ...@@ -142,7 +142,8 @@ static int lm36274_probe(struct platform_device *pdev)
chip->led_dev.max_brightness = MAX_BRIGHTNESS_11BIT; chip->led_dev.max_brightness = MAX_BRIGHTNESS_11BIT;
chip->led_dev.brightness_set_blocking = lm36274_brightness_set; 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) if (ret)
dev_err(chip->dev, "Failed to register LED for node %pfw\n", dev_err(chip->dev, "Failed to register LED for node %pfw\n",
init_data.fwnode); init_data.fwnode);
...@@ -152,15 +153,6 @@ static int lm36274_probe(struct platform_device *pdev) ...@@ -152,15 +153,6 @@ static int lm36274_probe(struct platform_device *pdev)
return ret; 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[] = { static const struct of_device_id of_lm36274_leds_match[] = {
{ .compatible = "ti,lm36274-backlight", }, { .compatible = "ti,lm36274-backlight", },
{}, {},
...@@ -169,7 +161,6 @@ MODULE_DEVICE_TABLE(of, of_lm36274_leds_match); ...@@ -169,7 +161,6 @@ MODULE_DEVICE_TABLE(of, of_lm36274_leds_match);
static struct platform_driver lm36274_driver = { static struct platform_driver lm36274_driver = {
.probe = lm36274_probe, .probe = lm36274_probe,
.remove = lm36274_remove,
.driver = { .driver = {
.name = "lm36274-leds", .name = "lm36274-leds",
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment