gpio-timberdale: fix a potential wrapping issue

->last_ier is an unsigned long but the high bits can't be used int the
original code because the shift wraps.

Cc: stable@kernel.org
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Dan Carpenter 2012-10-11 09:56:35 +03:00 committed by Linus Walleij
parent ddffeb8c4d
commit d79550a7bc
1 changed files with 2 additions and 2 deletions

View File

@ -116,7 +116,7 @@ static void timbgpio_irq_disable(struct irq_data *d)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&tgpio->lock, flags); spin_lock_irqsave(&tgpio->lock, flags);
tgpio->last_ier &= ~(1 << offset); tgpio->last_ier &= ~(1UL << offset);
iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER);
spin_unlock_irqrestore(&tgpio->lock, flags); spin_unlock_irqrestore(&tgpio->lock, flags);
} }
@ -128,7 +128,7 @@ static void timbgpio_irq_enable(struct irq_data *d)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&tgpio->lock, flags); spin_lock_irqsave(&tgpio->lock, flags);
tgpio->last_ier |= 1 << offset; tgpio->last_ier |= 1UL << offset;
iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER);
spin_unlock_irqrestore(&tgpio->lock, flags); spin_unlock_irqrestore(&tgpio->lock, flags);
} }