Skip to content

Commit

Permalink
backlight: adp5520: Fix error handling in adp5520_bl_probe()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
khoroshilov authored and Lee Jones committed Jan 4, 2017
1 parent cc21942 commit 0eb3fba
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/video/backlight/adp5520_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,18 @@ static int adp5520_bl_probe(struct platform_device *pdev)
}

platform_set_drvdata(pdev, bl);
ret |= adp5520_bl_setup(bl);
ret = adp5520_bl_setup(bl);
if (ret) {
dev_err(&pdev->dev, "failed to setup\n");
if (data->pdata->en_ambl_sens)
sysfs_remove_group(&bl->dev.kobj,
&adp5520_bl_attr_group);
return ret;
}

backlight_update_status(bl);

return ret;
return 0;
}

static int adp5520_bl_remove(struct platform_device *pdev)
Expand Down

0 comments on commit 0eb3fba

Please sign in to comment.