platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: mjg59@srcf.ucam.org, dvhart@infradead.org, andy@infradead.org,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] platform/x86: dell-laptop: Handle return error form dell_get_intensity.
Date: Wed, 8 Mar 2017 13:54:06 +0100	[thread overview]
Message-ID: <20170308125406.GB30539@pali> (raw)
In-Reply-To: <1488975747-32184-1-git-send-email-arvind.yadav.cs@gmail.com>

Hi!

On Wednesday 08 March 2017 17:52:27 Arvind Yadav wrote:
> Here, dell_get_intensity can return an error.

Right. That is truth and we should check for errors.

> So we can assgine props.brightness as max_brightness.

But why to max_brightness? Seems that this is incorrect handling of
error too...

> This change is done using Coccinelle.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>  drivers/platform/x86/dell-laptop.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
> index f57dd28..0891de3 100644
> --- a/drivers/platform/x86/dell-laptop.c
> +++ b/drivers/platform/x86/dell-laptop.c
> @@ -2053,6 +2053,9 @@ static int __init dell_init(void)
>  
>  		dell_backlight_device->props.brightness =
>  			dell_get_intensity(dell_backlight_device);
> +		if (dell_backlight_device->props.brightness < 0) {
> +			dell_backlight_device->props.brightness = props.max_brightness;
> +		}
>  		backlight_update_status(dell_backlight_device);
>  	}
>  

-- 
Pali Rohár
pali.rohar@gmail.com

  reply	other threads:[~2017-03-08 12:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-08 12:22 [PATCH] platform/x86: dell-laptop: Handle return error form dell_get_intensity Arvind Yadav
2017-03-08 12:54 ` Pali Rohár [this message]
2017-03-09  5:43   ` Arvind Yadav

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=20170308125406.GB30539@pali \
    --to=pali.rohar@gmail.com \
    --cc=andy@infradead.org \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=dvhart@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=platform-driver-x86@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 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).