mirror of https://gitee.com/openkylin/linux.git
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:
parent
ddffeb8c4d
commit
d79550a7bc
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue