All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: omap-usb-tll: fix register offsets
@ 2017-08-23 14:44 Arnd Bergmann
  2017-08-24  8:46 ` Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2017-08-23 14:44 UTC (permalink / raw)
  To: Tony Lindgren, Lee Jones
  Cc: Arnd Bergmann, Roger Quadros, linux-omap, linux-kernel

gcc-8 notices that the register number calculation is wrong
when the offset is an 'u8' but the number is larger than 256:

drivers/mfd/omap-usb-tll.c: In function 'omap_tll_init':
drivers/mfd/omap-usb-tll.c:90:46: error: overflow in conversion from 'int' to 'u8 {aka unsigned char}' chages value from 'i * 256 + 2070' to '22' [-Werror=overflow]

This addresses it by always using a 32-bit offset number for
the register. This is apparently an old problem that previous
compilers did not find.

Fixes: 16fa3dc75c22 ("mfd: omap-usb-tll: HOST TLL platform driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/mfd/omap-usb-tll.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
index 6f5300b0eb31..44a5d66314c6 100644
--- a/drivers/mfd/omap-usb-tll.c
+++ b/drivers/mfd/omap-usb-tll.c
@@ -131,12 +131,12 @@ static inline u32 usbtll_read(void __iomem *base, u32 reg)
 	return readl_relaxed(base + reg);
 }
 
-static inline void usbtll_writeb(void __iomem *base, u8 reg, u8 val)
+static inline void usbtll_writeb(void __iomem *base, u32 reg, u8 val)
 {
 	writeb_relaxed(val, base + reg);
 }
 
-static inline u8 usbtll_readb(void __iomem *base, u8 reg)
+static inline u8 usbtll_readb(void __iomem *base, u32 reg)
 {
 	return readb_relaxed(base + reg);
 }
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mfd: omap-usb-tll: fix register offsets
  2017-08-23 14:44 [PATCH] mfd: omap-usb-tll: fix register offsets Arnd Bergmann
@ 2017-08-24  8:46 ` Lee Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2017-08-24  8:46 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Tony Lindgren, Roger Quadros, linux-omap, linux-kernel

On Wed, 23 Aug 2017, Arnd Bergmann wrote:

> gcc-8 notices that the register number calculation is wrong
> when the offset is an 'u8' but the number is larger than 256:
> 
> drivers/mfd/omap-usb-tll.c: In function 'omap_tll_init':
> drivers/mfd/omap-usb-tll.c:90:46: error: overflow in conversion from 'int' to 'u8 {aka unsigned char}' chages value from 'i * 256 + 2070' to '22' [-Werror=overflow]
> 
> This addresses it by always using a 32-bit offset number for
> the register. This is apparently an old problem that previous
> compilers did not find.
> 
> Fixes: 16fa3dc75c22 ("mfd: omap-usb-tll: HOST TLL platform driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/mfd/omap-usb-tll.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-24  8:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-23 14:44 [PATCH] mfd: omap-usb-tll: fix register offsets Arnd Bergmann
2017-08-24  8:46 ` Lee Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.