* [PATCH 2/6] MIPS: ip27-timer: fix unsigned irq < 0
@ 2008-04-16 1:43 Roel Kluin
2008-04-16 9:15 ` Thomas Bogendoerfer
0 siblings, 1 reply; 5+ messages in thread
From: Roel Kluin @ 2008-04-16 1:43 UTC (permalink / raw)
To: ralf; +Cc: linux-mips, lkml
irq is unsigned, cast to signed to evaluate the allocate_irqno() return value,
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index 25d3baf..3c08afd 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -222,19 +222,19 @@ static void __init hub_rt_clock_event_global_init(void)
unsigned int irq;
do {
smp_wmb();
irq = rt_timer_irq;
if (irq)
break;
irq = allocate_irqno();
- if (irq < 0)
+ if ((int) irq < 0)
panic("Allocation of irq number for timer failed");
} while (xchg(&rt_timer_irq, irq));
set_irq_chip_and_handler(irq, &rt_irq_type, handle_percpu_irq);
setup_irq(irq, &hub_rt_irqaction);
}
static cycle_t hub_rt_read(void)
{
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 2/6] MIPS: ip27-timer: fix unsigned irq < 0
2008-04-16 1:43 [PATCH 2/6] MIPS: ip27-timer: fix unsigned irq < 0 Roel Kluin
@ 2008-04-16 9:15 ` Thomas Bogendoerfer
2008-04-16 15:09 ` [PATCH 2/6 v2] MIPS: ip27-timer: unsigned irq to evaluate allocate_irqno() Roel Kluin
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Bogendoerfer @ 2008-04-16 9:15 UTC (permalink / raw)
To: Roel Kluin; +Cc: ralf, linux-mips, lkml
On Wed, Apr 16, 2008 at 03:43:56AM +0200, Roel Kluin wrote:
> irq is unsigned, cast to signed to evaluate the allocate_irqno() return value,
>
> Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
> ---
> diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
> index 25d3baf..3c08afd 100644
> --- a/arch/mips/sgi-ip27/ip27-timer.c
> +++ b/arch/mips/sgi-ip27/ip27-timer.c
> @@ -222,19 +222,19 @@ static void __init hub_rt_clock_event_global_init(void)
> unsigned int irq;
>
> do {
> smp_wmb();
> irq = rt_timer_irq;
> if (irq)
> break;
>
> irq = allocate_irqno();
> - if (irq < 0)
> + if ((int) irq < 0)
Why don't you just make irq and rt_timer_irq an int ?
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 2/6 v2] MIPS: ip27-timer: unsigned irq to evaluate allocate_irqno()
2008-04-16 9:15 ` Thomas Bogendoerfer
@ 2008-04-16 15:09 ` Roel Kluin
2008-04-16 22:27 ` Thomas Bogendoerfer
0 siblings, 1 reply; 5+ messages in thread
From: Roel Kluin @ 2008-04-16 15:09 UTC (permalink / raw)
To: Thomas Bogendoerfer; +Cc: ralf, linux-mips, lkml
Thomas Bogendoerfer wrote:
> On Wed, Apr 16, 2008 at 03:43:56AM +0200, Roel Kluin wrote:
>> irq is unsigned, cast to signed to evaluate the allocate_irqno() return value,
>> + if ((int) irq < 0)
>
> Why don't you just make irq and rt_timer_irq an int ?
Ok, thanks, It should be right, but I cannot test this (no hardware).
---
when allocate_irqno() returns a negative error value, but is stored in an
unsigned variable 'irq', the test '(irq < 0)' won't work.
Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index 25d3baf..9cebc9e 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -158,7 +158,7 @@ static void rt_set_mode(enum clock_event_mode mode,
}
}
-unsigned int rt_timer_irq;
+int rt_timer_irq;
static irqreturn_t hub_rt_counter_handler(int irq, void *dev_id)
{
@@ -219,7 +219,7 @@ static void __cpuinit hub_rt_clock_event_init(void)
static void __init hub_rt_clock_event_global_init(void)
{
- unsigned int irq;
+ int irq;
do {
smp_wmb();
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 2/6 v2] MIPS: ip27-timer: unsigned irq to evaluate allocate_irqno()
2008-04-16 15:09 ` [PATCH 2/6 v2] MIPS: ip27-timer: unsigned irq to evaluate allocate_irqno() Roel Kluin
@ 2008-04-16 22:27 ` Thomas Bogendoerfer
2008-04-17 10:59 ` Ralf Baechle
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Bogendoerfer @ 2008-04-16 22:27 UTC (permalink / raw)
To: Roel Kluin; +Cc: ralf, linux-mips, lkml
On Wed, Apr 16, 2008 at 05:09:58PM +0200, Roel Kluin wrote:
> Thomas Bogendoerfer wrote:
> > On Wed, Apr 16, 2008 at 03:43:56AM +0200, Roel Kluin wrote:
> >> irq is unsigned, cast to signed to evaluate the allocate_irqno() return value,
>
> >> + if ((int) irq < 0)
> >
> > Why don't you just make irq and rt_timer_irq an int ?
>
> Ok, thanks, It should be right, but I cannot test this (no hardware).
I've tested it on real hardware.
Acked-By: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/6 v2] MIPS: ip27-timer: unsigned irq to evaluate allocate_irqno()
2008-04-16 22:27 ` Thomas Bogendoerfer
@ 2008-04-17 10:59 ` Ralf Baechle
0 siblings, 0 replies; 5+ messages in thread
From: Ralf Baechle @ 2008-04-17 10:59 UTC (permalink / raw)
To: Thomas Bogendoerfer; +Cc: Roel Kluin, linux-mips, lkml
On Thu, Apr 17, 2008 at 12:27:56AM +0200, Thomas Bogendoerfer wrote:
> On Wed, Apr 16, 2008 at 05:09:58PM +0200, Roel Kluin wrote:
> > Thomas Bogendoerfer wrote:
> > > On Wed, Apr 16, 2008 at 03:43:56AM +0200, Roel Kluin wrote:
> > >> irq is unsigned, cast to signed to evaluate the allocate_irqno() return value,
> >
> > >> + if ((int) irq < 0)
> > >
> > > Why don't you just make irq and rt_timer_irq an int ?
> >
> > Ok, thanks, It should be right, but I cannot test this (no hardware).
>
> I've tested it on real hardware.
>
> Acked-By: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Thanks, applied.
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-04-17 11:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-16 1:43 [PATCH 2/6] MIPS: ip27-timer: fix unsigned irq < 0 Roel Kluin
2008-04-16 9:15 ` Thomas Bogendoerfer
2008-04-16 15:09 ` [PATCH 2/6 v2] MIPS: ip27-timer: unsigned irq to evaluate allocate_irqno() Roel Kluin
2008-04-16 22:27 ` Thomas Bogendoerfer
2008-04-17 10:59 ` Ralf Baechle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox