From: Darren Hart <dvhart@infradead.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Matthew Garrett <matthew.garrett@nebula.com>,
Azael Avalos <coproscefalo@gmail.com>,
platform-driver-x86@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] toshiba_acpi: fix and cleanup toshiba_kbd_bl_mode_store()
Date: Wed, 03 Sep 2014 17:48:15 +0000 [thread overview]
Message-ID: <20140903174815.GA7153@vmdeb7> (raw)
In-Reply-To: <20140903114437.GA3359@mwanda>
On Wed, Sep 03, 2014 at 02:44:37PM +0300, Dan Carpenter wrote:
> The current code just returns -EINVAL because mode can't be equal to
> both 1 and 2.
>
> Also this function is messy so I have cleaned it up:
> 1) Remove initializers like "int time = -1". Initializing variables to
> garbage values turns off GCC's uninitialized variable warnings so it
> can lead to bugs.
> 2) Use kstrtoint() instead of sscanf().
> 3) Use SCI_KBD_MODE_FNZ and SCI_KBD_MODE_AUTO instead of magic numbers 1
> and 2.
> 4) Don't check for "mode = -1" because that can't happen.
> 5) Preserve the error code from toshiba_kbd_illum_status_set().
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Queued, thanks.
--
Darren Hart
Intel Open Source Technology Center
WARNING: multiple messages have this Message-ID (diff)
From: Darren Hart <dvhart@infradead.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Matthew Garrett <matthew.garrett@nebula.com>,
Azael Avalos <coproscefalo@gmail.com>,
platform-driver-x86@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch] toshiba_acpi: fix and cleanup toshiba_kbd_bl_mode_store()
Date: Wed, 3 Sep 2014 10:48:15 -0700 [thread overview]
Message-ID: <20140903174815.GA7153@vmdeb7> (raw)
In-Reply-To: <20140903114437.GA3359@mwanda>
On Wed, Sep 03, 2014 at 02:44:37PM +0300, Dan Carpenter wrote:
> The current code just returns -EINVAL because mode can't be equal to
> both 1 and 2.
>
> Also this function is messy so I have cleaned it up:
> 1) Remove initializers like "int time = -1". Initializing variables to
> garbage values turns off GCC's uninitialized variable warnings so it
> can lead to bugs.
> 2) Use kstrtoint() instead of sscanf().
> 3) Use SCI_KBD_MODE_FNZ and SCI_KBD_MODE_AUTO instead of magic numbers 1
> and 2.
> 4) Don't check for "mode == -1" because that can't happen.
> 5) Preserve the error code from toshiba_kbd_illum_status_set().
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Queued, thanks.
--
Darren Hart
Intel Open Source Technology Center
next prev parent reply other threads:[~2014-09-03 17:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-03 11:44 [patch] toshiba_acpi: fix and cleanup toshiba_kbd_bl_mode_store() Dan Carpenter
2014-09-03 11:44 ` Dan Carpenter
2014-09-03 17:48 ` Darren Hart [this message]
2014-09-03 17:48 ` Darren Hart
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=20140903174815.GA7153@vmdeb7 \
--to=dvhart@infradead.org \
--cc=coproscefalo@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=matthew.garrett@nebula.com \
--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 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.