Skip to contentSkip to conversation

88pm860x_bl: fix error handling in pm860x_backlight_probe

PATCH New Axel Lin 1 participant 1 message May 10, 2010

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 88pm860x_bl: fix error handling in pm860x_backlight_probe

This patch includes below fixes:
1. fixes a memory leak by kfree(data) in the case of data->port < 0.
2. properly unregisters a previously registered backlight device object in error handling

---
 drivers/video/backlight/88pm860x_bl.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/drivers/video/backlight/88pm860x_bl.c
index 68d2518..38ffc3f 100644

drivers/video/backlight/88pm860x_bl.c +0 -0
@@ -222,6 +222,7 @@ static int pm860x_backlight_probe(struct

platform_device *pdev)
data->port = __check_device(pdata, name);
if (data->port < 0) {
dev_err(&pdev->dev, "wrong platform data is assigned");
+ kfree(data);
return -EINVAL;
}

@@ -266,6 +267,7 @@ static int pm860x_backlight_probe(struct platform_device *pdev)
backlight_update_status(bl);
return 0;
out:
+ backlight_device_unregister(bl);
kfree(data);
return ret;
}

Signature · 1 line
1.5.4.3