All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform-drivers: x86: Fix off-by-one valid offset range checking
@ 2014-04-15  1:08 Axel Lin
  2014-04-15  1:56 ` Du, Alek
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2014-04-15  1:08 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: Alek Du, platform-driver-x86

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH] platform-drivers: x86: Fix off-by-one valid offset range checking
  2014-04-15  1:08 [PATCH] platform-drivers: x86: Fix off-by-one valid offset range checking Axel Lin
@ 2014-04-15  1:56 ` Du, Alek
  0 siblings, 0 replies; 2+ messages in thread
From: Du, Alek @ 2014-04-15  1:56 UTC (permalink / raw)
  To: Axel Lin, Matthew Garrett; +Cc: platform-driver-x86

Hmmm, my bad.

There is another place need fix as well.

static int pmic_gpio_get(struct gpio_chip *chip, unsigned offset)
{
        u8 r;
        int ret;

        /* we only have 8 GPIO pins we can use as input */
        if (offset > 8)
                return -EOPNOTSUPP;

Could you help to include this fix as well ?

Thanks,
Alek
-----Original Message-----
From: Axel Lin [mailto:axel.lin@ingics.com] 
Sent: Tuesday, April 15, 2014 9:08 AM
To: Matthew Garrett
Cc: Du, Alek; platform-driver-x86@vger.kernel.org
Subject: [PATCH] platform-drivers: x86: Fix off-by-one valid offset range checking

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




^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-15  1:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-15  1:08 [PATCH] platform-drivers: x86: Fix off-by-one valid offset range checking Axel Lin
2014-04-15  1:56 ` Du, Alek

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.