diff options
author | Alexey Khoroshilov <khoroshilov@ispras.ru> | 2016-07-08 18:19:51 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2017-01-04 06:37:31 -0500 |
commit | 0eb3fba8c68275f0122f65f7316efaaf86448016 (patch) | |
tree | 5d46ec3cd8c23a385d8784bf053ed1e6f310c22c | |
parent | cc21942bce652d1a92dae85b785378256e1df1f7 (diff) |
backlight: adp5520: Fix error handling in adp5520_bl_probe()
If adp5520_bl_setup() fails, sysfs group left unremoved.
By the way, fix overcomplicated assignement of error code.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r-- | drivers/video/backlight/adp5520_bl.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c index dd88ba1d71ce..35373e2065b2 100644 --- a/drivers/video/backlight/adp5520_bl.c +++ b/drivers/video/backlight/adp5520_bl.c | |||
@@ -332,10 +332,18 @@ static int adp5520_bl_probe(struct platform_device *pdev) | |||
332 | } | 332 | } |
333 | 333 | ||
334 | platform_set_drvdata(pdev, bl); | 334 | platform_set_drvdata(pdev, bl); |
335 | ret |= adp5520_bl_setup(bl); | 335 | ret = adp5520_bl_setup(bl); |
336 | if (ret) { | ||
337 | dev_err(&pdev->dev, "failed to setup\n"); | ||
338 | if (data->pdata->en_ambl_sens) | ||
339 | sysfs_remove_group(&bl->dev.kobj, | ||
340 | &adp5520_bl_attr_group); | ||
341 | return ret; | ||
342 | } | ||
343 | |||
336 | backlight_update_status(bl); | 344 | backlight_update_status(bl); |
337 | 345 | ||
338 | return ret; | 346 | return 0; |
339 | } | 347 | } |
340 | 348 | ||
341 | static int adp5520_bl_remove(struct platform_device *pdev) | 349 | static int adp5520_bl_remove(struct platform_device *pdev) |