Skip to contentSkip to conversation

gpio-ir-recv: a couple signedness bugs

PATCH In review Dan Carpenter 2 participants 2 messages Mar 10, 2012 – Mar 11, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio-ir-recv: a couple signedness bugs

There are couple places where we check unsigned values for negative. I changed ->gpin_nr to signed because in gpio_ir_recv_probe() we do:

        if (pdata->gpio_nr < 0)
                return -EINVAL;

I also change gval to a signed int in gpio_ir_recv_irq() because that's the type that gpio_get_value_cansleep() returns and we test for negative returns.

drivers/media/rc/gpio-ir-recv.c +2 -2
index 6744479..0d87545 100644
@@ -26,14 +26,14 @@
 
 struct gpio_rc_dev {
 	struct rc_dev *rcdev;
-	unsigned int gpio_nr;
+	int gpio_nr;
 	bool active_low;
 };
 
 static irqreturn_t gpio_ir_recv_irq(int irq, void *dev_id)
 {
 	struct gpio_rc_dev *gpio_dev = dev_id;
-	unsigned int gval;
+	int gval;
 	int rc = 0;
 	enum raw_event_type type = IR_SPACE;
 
include/media/gpio-ir-recv.h +1 -1
index 61a7fbb..67797bf 100644
@@ -14,7 +14,7 @@
 #define __GPIO_IR_RECV_H__
 
 struct gpio_ir_recv_platform_data {
-	unsigned int gpio_nr;
+	int gpio_nr;
 	bool active_low;
 };
 
Reviewed-by on v1 1/1
#1 lore raw

Hi Dan,

Quoted 10 lines · Dan Carpenter

There are couple places where we check unsigned values for negative. I changed ->gpin_nr to signed because in gpio_ir_recv_probe() we do:

         if (pdata->gpio_nr<  0)
                 return -EINVAL;

I also change gval to a signed int in gpio_ir_recv_irq() because that's the type that gpio_get_value_cansleep() returns and we test for negative returns.

Thanks.

---Trilok Soni

--
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.