From: Andy Walls Date: Thu, 4 Sep 2008 16:16:40 +0000 (-0300) Subject: V4L/DVB (8915): cx18: Increment u8 pointers not void pointers. X-Git-Tag: Ubuntu-5.13.0-19.19~39574^2~202 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=ac2b97b13e5627127b8e29dc0e1e1d7be03eaae4;p=mirror_ubuntu-jammy-kernel.git V4L/DVB (8915): cx18: Increment u8 pointers not void pointers. cx18: Increment u8 pointers not void pointers. Incrementing void pointers is dubious and the real intent in cx18_memcpy_fromio() and cx18_memset_io() is to increment by bytes, so use u8 pointers instead. Signed-off-by: Andy Walls Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/cx18/cx18-io.c b/drivers/media/video/cx18/cx18-io.c index d92f627d35e4..5d07b0fd8a17 100644 --- a/drivers/media/video/cx18/cx18-io.c +++ b/drivers/media/video/cx18/cx18-io.c @@ -27,63 +27,67 @@ void cx18_memcpy_fromio(struct cx18 *cx, void *to, const void __iomem *from, unsigned int len) { + const u8 *src = from; + u8 *dst = to; + /* Align reads on the CX23418's addresses */ - if ((len > 0) && ((unsigned)from & 1)) { - *((u8 *)to) = cx18_readb(cx, from); + if ((len > 0) && ((unsigned long) src & 1)) { + *dst = cx18_readb(cx, src); len--; - to++; - from++; + dst++; + src++; } - if ((len > 1) && ((unsigned)from & 2)) { - *((u16 *)to) = cx18_raw_readw(cx, from); + if ((len > 1) && ((unsigned long) src & 2)) { + *((u16 *)dst) = cx18_raw_readw(cx, src); len -= 2; - to += 2; - from += 2; + dst += 2; + src += 2; } while (len > 3) { - *((u32 *)to) = cx18_raw_readl(cx, from); + *((u32 *)dst) = cx18_raw_readl(cx, src); len -= 4; - to += 4; - from += 4; + dst += 4; + src += 4; } if (len > 1) { - *((u16 *)to) = cx18_raw_readw(cx, from); + *((u16 *)dst) = cx18_raw_readw(cx, src); len -= 2; - to += 2; - from += 2; + dst += 2; + src += 2; } if (len > 0) - *((u8 *)to) = cx18_readb(cx, from); + *dst = cx18_readb(cx, src); } void cx18_memset_io(struct cx18 *cx, void __iomem *addr, int val, size_t count) { + u8 *dst = addr; u16 val2 = val | (val << 8); u32 val4 = val2 | (val2 << 16); /* Align writes on the CX23418's addresses */ - if ((count > 0) && ((unsigned)addr & 1)) { - cx18_writeb(cx, (u8) val, addr); + if ((count > 0) && ((unsigned long)dst & 1)) { + cx18_writeb(cx, (u8) val, dst); count--; - addr++; + dst++; } - if ((count > 1) && ((unsigned)addr & 2)) { - cx18_writew(cx, val2, addr); + if ((count > 1) && ((unsigned long)dst & 2)) { + cx18_writew(cx, val2, dst); count -= 2; - addr += 2; + dst += 2; } while (count > 3) { - cx18_writel(cx, val4, addr); + cx18_writel(cx, val4, dst); count -= 4; - addr += 4; + dst += 4; } if (count > 1) { - cx18_writew(cx, val2, addr); + cx18_writew(cx, val2, dst); count -= 2; - addr += 2; + dst += 2; } if (count > 0) - cx18_writeb(cx, (u8) val, addr); + cx18_writeb(cx, (u8) val, dst); } void cx18_sw1_irq_enable(struct cx18 *cx, u32 val)