All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Hennerich <michael.hennerich@analog.com>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Jingoo Han <jingoohan1@gmail.com>,
	Lee Jones <lee.jones@linaro.org>,
	linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	ldv-project@linuxtesting.org
Subject: Re: [PATCH] backlight: adp5520: fix error handling in adp5520_bl_probe()
Date: Mon, 11 Jul 2016 07:25:44 +0000	[thread overview]
Message-ID: <578349F8.2070207@analog.com> (raw)
In-Reply-To: <1468016392-6061-1-git-send-email-khoroshilov@ispras.ru>

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

WARNING: multiple messages have this Message-ID (diff)
From: Michael Hennerich <michael.hennerich@analog.com>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Jingoo Han <jingoohan1@gmail.com>,
	Lee Jones <lee.jones@linaro.org>, <linux-fbdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <ldv-project@linuxtesting.org>
Subject: Re: [PATCH] backlight: adp5520: fix error handling in adp5520_bl_probe()
Date: Mon, 11 Jul 2016 09:25:44 +0200	[thread overview]
Message-ID: <578349F8.2070207@analog.com> (raw)
In-Reply-To: <1468016392-6061-1-git-send-email-khoroshilov@ispras.ru>

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

  reply	other threads:[~2016-07-11  7:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-08 22:19 [PATCH] backlight: adp5520: fix error handling in adp5520_bl_probe() Alexey Khoroshilov
2016-07-08 22:19 ` Alexey Khoroshilov
2016-07-11  7:25 ` Michael Hennerich [this message]
2016-07-11  7:25   ` Michael Hennerich
2016-08-05 13:29 ` Lee Jones
2016-08-05 13:29   ` Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=578349F8.2070207@analog.com \
    --to=michael.hennerich@analog.com \
    --cc=jingoohan1@gmail.com \
    --cc=khoroshilov@ispras.ru \
    --cc=ldv-project@linuxtesting.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.