Skip to content

Commit 3e89999

Browse files
khoroshilovgregkh
authored andcommitted
backlight: adp5520: Fix error handling in adp5520_bl_probe()
[ Upstream commit 0eb3fba8c68275f0122f65f7316efaaf86448016 ] 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> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d6f21ea commit 3e89999

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

drivers/video/backlight/adp5520_bl.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,18 @@ static int adp5520_bl_probe(struct platform_device *pdev)
332332
}
333333

334334
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+
336344
backlight_update_status(bl);
337345

338-
return ret;
346+
return 0;
339347
}
340348

341349
static int adp5520_bl_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)