mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 23:13:01 +02:00
leds: max5970: Fix unreleased fwnode_handle in probe function
An object initialized via device_get_named_child_node() requires calls
to fwnode_handle_put() when it is no longer required to avoid leaking
memory.
Add the automatic cleanup facility for 'led_node' to ensure that
fwnode_handle_put() is called in all execution paths.
Fixes: 736214b4b0
("leds: max5970: Add support for max5970")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241031-max5970-of_node_put-v2-1-0ffe1f1d3bc9@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
parent
32360bf6a5
commit
02f58f9741
|
@ -45,7 +45,7 @@ static int max5970_led_set_brightness(struct led_classdev *cdev,
|
||||||
|
|
||||||
static int max5970_led_probe(struct platform_device *pdev)
|
static int max5970_led_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct fwnode_handle *led_node, *child;
|
struct fwnode_handle *child;
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct regmap *regmap;
|
struct regmap *regmap;
|
||||||
struct max5970_led *ddata;
|
struct max5970_led *ddata;
|
||||||
|
@ -55,7 +55,8 @@ static int max5970_led_probe(struct platform_device *pdev)
|
||||||
if (!regmap)
|
if (!regmap)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
led_node = device_get_named_child_node(dev->parent, "leds");
|
struct fwnode_handle *led_node __free(fwnode_handle) =
|
||||||
|
device_get_named_child_node(dev->parent, "leds");
|
||||||
if (!led_node)
|
if (!led_node)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user