From: Axel Lin <axel.lin@ingics.com>
To: Matthew Garrett <matthew.garrett@nebula.com>
Cc: Alek Du <alek.du@intel.com>, platform-driver-x86@vger.kernel.org
Subject: [PATCH] platform-drivers: x86: Fix off-by-one valid offset range checking
Date: Tue, 15 Apr 2014 09:08:24 +0800 [thread overview]
Message-ID: <1397524104.11920.2.camel@phoenix> (raw)
Only pin 0-7 support input, so the valid offset range should be 0 ~ 7.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/platform/x86/intel_pmic_gpio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/intel_pmic_gpio.c b/drivers/platform/x86/intel_pmic_gpio.c
index 2805988..281cfcb 100644
--- a/drivers/platform/x86/intel_pmic_gpio.c
+++ b/drivers/platform/x86/intel_pmic_gpio.c
@@ -91,7 +91,7 @@ static void pmic_program_irqtype(int gpio, int type)
static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
{
- if (offset > 8) {
+ if (offset >= 8) {
pr_err("only pin 0-7 support input\n");
return -1;/* we only have 8 GPIO can use as input */
}
--
1.8.3.2
next reply other threads:[~2014-04-15 1:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-15 1:08 Axel Lin [this message]
2014-04-15 1:56 ` [PATCH] platform-drivers: x86: Fix off-by-one valid offset range checking Du, Alek
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=1397524104.11920.2.camel@phoenix \
--to=axel.lin@ingics.com \
--cc=alek.du@intel.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox