]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
[media] tc358743: fix register i2c_rd/wr functions
authorArnd Bergmann <arnd@arndb.de>
Wed, 8 Feb 2017 21:14:13 +0000 (19:14 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 3 Mar 2017 10:22:43 +0000 (07:22 -0300)
commit3538aa6ecfb2dd727a40f9ebbbf25a0c2afe6226
tree6614ef690d3f21992bb39bec8e7974444398e110
parent371d1143a5581718f7c687e4da259f80ab0c4634
[media] tc358743: fix register i2c_rd/wr functions

While testing with CONFIG_UBSAN, I got this warning:

drivers/media/i2c/tc358743.c: In function 'tc358743_probe':
drivers/media/i2c/tc358743.c:1930:1: error: the frame size of 2480 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]

The problem is that the i2c_rd8/wr8/rd16/... functions in this driver pass
a pointer to a local variable into a common function, and each call to one
of them adds another variable plus redzone to the stack.

I also noticed that the way this is done is broken on big-endian machines,
as we copy the registers in CPU byte order.

To address both those problems, I'm adding two helper functions for reading
a register of up to 32 bits with correct endianess and change all other
functions to use that instead. Just to be sure we don't get the problem
back with changed optimizations in gcc, I'm also marking the new functions
as 'noinline', although my tests with gcc-7 don't require that.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/i2c/tc358743.c