Skip to contentSkip to conversation

xen: events: fix error checks in bind_*_to_irqhandler()

PATCH In review Nicolas Kaiser 2 participants 3 messages Mar 30, 2011

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

PATCH 1/1 xen: events: fix error checks in bind_*_to_irqhandler()

Checking 'irq < 0' doesn't work when 'irq' is unsigned.

The assigned bind_evtchn_to_irq() and bind_virq_to_irq() return int, so using int appears appropriate.

---
 drivers/xen/events.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/xen/events.c +2 -4
index 036343b..589f0a5 100644
@@ -912,8 +912,7 @@ int bind_evtchn_to_irqhandler(unsigned int evtchn,
 			      unsigned long irqflags,
 			      const char *devname, void *dev_id)
 {
-	unsigned int irq;
-	int retval;
+	int irq, retval;
 
 	irq = bind_evtchn_to_irq(evtchn);
 	if (irq < 0)
@@ -955,8 +954,7 @@ int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu,
 			    irq_handler_t handler,
 			    unsigned long irqflags, const char *devname, void *dev_id)
 {
-	unsigned int irq;
-	int retval;
+	int irq, retval;
 
 	irq = bind_virq_to_irq(virq, cpu);
 	if (irq < 0)
Signature · 1 line
1.7.3.4
#1 lore raw
Quoted 4 lines · Nicolas Kaiser

Checking 'irq < 0' doesn't work when 'irq' is unsigned.

The assigned bind_evtchn_to_irq() and bind_virq_to_irq() return int, so using int appears appropriate.

Whoops. Good check. Will have it queue up for rc2.

Will fix up the bind_virq_to_irqhandler case as well.

Quoted 37 lines
---
 drivers/xen/events.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/xen/events.c +2 -4
index 036343b..589f0a5 100644
@@ -912,8 +912,7 @@ int bind_evtchn_to_irqhandler(unsigned int evtchn,
 			      unsigned long irqflags,
 			      const char *devname, void *dev_id)
 {
-	unsigned int irq;
-	int retval;
+	int irq, retval;
 
 	irq = bind_evtchn_to_irq(evtchn);
 	if (irq < 0)
@@ -955,8 +954,7 @@ int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu,
 			    irq_handler_t handler,
 			    unsigned long irqflags, const char *devname, void *dev_id)
 {
-	unsigned int irq;
-	int retval;
+	int irq, retval;
 
 	irq = bind_virq_to_irq(virq, cpu);
 	if (irq < 0)
Signature · 6 lines
1.7.3.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
#2 lore raw
In reply to Nicolas Kaiser
Quoted 4 lines · Nicolas Kaiser

Checking 'irq < 0' doesn't work when 'irq' is unsigned.

The assigned bind_evtchn_to_irq() and bind_virq_to_irq() return int, so using int appears appropriate.

Whoops. Good check. Will have it queue up for rc2.

Will fix up the bind_virq_to_irqhandler case as well.

Quoted 37 lines
---
 drivers/xen/events.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/xen/events.c +2 -4
index 036343b..589f0a5 100644
@@ -912,8 +912,7 @@ int bind_evtchn_to_irqhandler(unsigned int evtchn,
 			      unsigned long irqflags,
 			      const char *devname, void *dev_id)
 {
-	unsigned int irq;
-	int retval;
+	int irq, retval;
 
 	irq = bind_evtchn_to_irq(evtchn);
 	if (irq < 0)
@@ -955,8 +954,7 @@ int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu,
 			    irq_handler_t handler,
 			    unsigned long irqflags, const char *devname, void *dev_id)
 {
-	unsigned int irq;
-	int retval;
+	int irq, retval;
 
 	irq = bind_virq_to_irq(virq, cpu);
 	if (irq < 0)
Signature · 6 lines
1.7.3.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/