* [PATCH] backlight: adp5520: fix error handling in adp5520_bl_probe()
@ 2016-07-08 22:19 Alexey Khoroshilov
2016-07-11 7:25 ` Michael Hennerich
2016-08-05 13:29 ` Lee Jones
0 siblings, 2 replies; 3+ messages in thread
From: Alexey Khoroshilov @ 2016-07-08 22:19 UTC (permalink / raw)
To: Michael Hennerich
Cc: Alexey Khoroshilov, Jingoo Han, Lee Jones, linux-fbdev,
linux-kernel, ldv-project
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>
---
drivers/video/backlight/adp5520_bl.c | 12 ++++++++++--
1 file 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)
}
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)
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] backlight: adp5520: fix error handling in adp5520_bl_probe()
2016-07-08 22:19 [PATCH] backlight: adp5520: fix error handling in adp5520_bl_probe() Alexey Khoroshilov
@ 2016-07-11 7:25 ` Michael Hennerich
2016-08-05 13:29 ` Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Michael Hennerich @ 2016-07-11 7:25 UTC (permalink / raw)
To: Alexey Khoroshilov
Cc: Jingoo Han, Lee Jones, linux-fbdev, linux-kernel, ldv-project
On 09.07.2016 00:19, Alexey Khoroshilov wrote:
> 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>
> ---
> drivers/video/backlight/adp5520_bl.c | 12 ++++++++++--
> 1 file 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)
> }
>
> 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)
>
--
Greetings,
Michael
--
Analog Devices GmbH Otl-Aicher Strasse 60-64 80807 München
Sitz der Gesellschaft München, Registergericht München HRB 40368,
Geschäftsführer: Peter Kolberg, Ali Raza Husain, Eileen Wynne
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] backlight: adp5520: fix error handling in adp5520_bl_probe()
2016-07-08 22:19 [PATCH] backlight: adp5520: fix error handling in adp5520_bl_probe() Alexey Khoroshilov
2016-07-11 7:25 ` Michael Hennerich
@ 2016-08-05 13:29 ` Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2016-08-05 13:29 UTC (permalink / raw)
To: Alexey Khoroshilov
Cc: Michael Hennerich, Jingoo Han, linux-fbdev, linux-kernel, ldv-project
On Sat, 09 Jul 2016, Alexey Khoroshilov wrote:
> 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>
> ---
> drivers/video/backlight/adp5520_bl.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
Applied, thanks.
> 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)
> }
>
> 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)
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-05 13:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-08 22:19 [PATCH] backlight: adp5520: fix error handling in adp5520_bl_probe() Alexey Khoroshilov
2016-07-11 7:25 ` Michael Hennerich
2016-08-05 13:29 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).