Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d79550a7 authored by Dan Carpenter's avatar Dan Carpenter Committed by Linus Walleij
Browse files

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent ddffeb8c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ static void timbgpio_irq_disable(struct irq_data *d)
	unsigned long 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);
	spin_unlock_irqrestore(&tgpio->lock, flags);
}
@@ -128,7 +128,7 @@ static void timbgpio_irq_enable(struct irq_data *d)
	unsigned long 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);
	spin_unlock_irqrestore(&tgpio->lock, flags);
}