acrn-kernel/drivers/media/i2c
Arnd Bergmann 287980e49f remove lots of IS_ERR_VALUE abuses
Most users of IS_ERR_VALUE() in the kernel are wrong, as they
pass an 'int' into a function that takes an 'unsigned long'
argument. This happens to work because the type is sign-extended
on 64-bit architectures before it gets converted into an
unsigned type.

However, anything that passes an 'unsigned short' or 'unsigned int'
argument into IS_ERR_VALUE() is guaranteed to be broken, as are
8-bit integers and types that are wider than 'unsigned long'.

Andrzej Hajda has already fixed a lot of the worst abusers that
were causing actual bugs, but it would be nice to prevent any
users that are not passing 'unsigned long' arguments.

This patch changes all users of IS_ERR_VALUE() that I could find
on 32-bit ARM randconfig builds and x86 allmodconfig. For the
moment, this doesn't change the definition of IS_ERR_VALUE()
because there are probably still architecture specific users
elsewhere.

Almost all the warnings I got are for files that are better off
using 'if (err)' or 'if (err < 0)'.
The only legitimate user I could find that we get a warning for
is the (32-bit only) freescale fman driver, so I did not remove
the IS_ERR_VALUE() there but changed the type to 'unsigned long'.
For 9pfs, I just worked around one user whose calling conventions
are so obscure that I did not dare change the behavior.

I was using this definition for testing:

 #define IS_ERR_VALUE(x) ((unsigned long*)NULL == (typeof (x)*)NULL && \
       unlikely((unsigned long long)(x) >= (unsigned long long)(typeof(x))-MAX_ERRNO))

which ends up making all 16-bit or wider types work correctly with
the most plausible interpretation of what IS_ERR_VALUE() was supposed
to return according to its users, but also causes a compile-time
warning for any users that do not pass an 'unsigned long' argument.

I suggested this approach earlier this year, but back then we ended
up deciding to just fix the users that are obviously broken. After
the initial warning that caused me to get involved in the discussion
(fs/gfs2/dir.c) showed up again in the mainline kernel, Linus
asked me to send the whole thing again.

[ Updated the 9p parts as per Al Viro  - Linus ]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: https://lkml.org/lkml/2016/1/7/363
Link: https://lkml.org/lkml/2016/5/27/486
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> # For nvmem part
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-05-27 15:26:11 -07:00
..
cx25840 [media] media framework: rename pads init function to media_entity_pads_init() 2016-01-11 12:19:03 -02:00
m5mols [media] m5mols: potential uninitialized variable 2016-04-13 17:10:59 -03:00
s5c73m3 [media] s5c73m3: remove duplicate module device table 2016-02-01 10:13:19 -02:00
smiapp [media] smiapp: provide g_skip_top_lines method in sensor ops 2016-05-06 15:40:04 -03:00
soc_camera [media] soc_camera: constify v4l2_subdev_sensor_ops structures 2016-01-25 08:57:26 -02:00
Kconfig [media] cs3308: add new 8-channel volume control driver 2015-12-18 13:35:51 -02:00
Makefile [media] cs3308: add new 8-channel volume control driver 2015-12-18 13:35:51 -02:00
ad9389b.c [media] media/i2c/adv*: make controls inheritable instead of private 2016-04-25 08:14:38 -03:00
adp1653.c remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00
adv7170.c
adv7175.c
adv7180.c [media] media: adv7180: Add of compatible strings for full family 2016-05-06 10:16:29 -03:00
adv7183.c
adv7183_regs.h
adv7343.c
adv7343_regs.h
adv7393.c
adv7393_regs.h
adv7511.c [media] media/i2c/adv*: make controls inheritable instead of private 2016-04-25 08:14:38 -03:00
adv7604.c [media] media/i2c/adv*: make controls inheritable instead of private 2016-04-25 08:14:38 -03:00
adv7842.c [media] media/i2c/adv*: make controls inheritable instead of private 2016-04-25 08:14:38 -03:00
ak881x.c
aptina-pll.c
aptina-pll.h
as3645a.c [media] media framework: rename pads init function to media_entity_pads_init() 2016-01-11 12:19:03 -02:00
bt819.c
bt856.c
bt866.c
cs53l32a.c
cs3308.c [media] cs3308: add new 8-channel volume control driver 2015-12-18 13:35:51 -02:00
cs5345.c
ir-kbd-i2c.c [media] media: i2c: Don't export ir-kbd-i2c module alias 2016-02-01 13:19:31 -02:00
ks0127.c
ks0127.h
lm3560.c [media] media framework: rename pads init function to media_entity_pads_init() 2016-01-11 12:19:03 -02:00
lm3646.c [media] media framework: rename pads init function to media_entity_pads_init() 2016-01-11 12:19:03 -02:00
m52790.c
ml86v7667.c
msp3400-driver.c [media] msp3400: initialize MC data 2016-02-01 07:25:31 -02:00
msp3400-driver.h [media] msp3400: use IS_ENABLED check instead of #if 2016-02-02 14:28:56 -02:00
msp3400-kthreads.c
mt9m032.c [media] media framework: rename pads init function to media_entity_pads_init() 2016-01-11 12:19:03 -02:00
mt9p031.c [media] media framework: rename pads init function to media_entity_pads_init() 2016-01-11 12:19:03 -02:00
mt9t001.c [media] media framework: rename pads init function to media_entity_pads_init() 2016-01-11 12:19:03 -02:00
mt9v011.c [media] mt9v011: add media controller support 2016-02-01 07:29:14 -02:00
mt9v032.c [media] mt9v032: Add reset and standby gpios 2016-01-25 15:15:34 -02:00
noon010pc30.c [media] media framework: rename pads init function to media_entity_pads_init() 2016-01-11 12:19:03 -02:00
ov2659.c [media] media: i2c: ov2659: speedup probe if no device connected 2016-01-25 15:15:37 -02:00
ov7640.c
ov7670.c
ov9650.c [media] V4L: ov9650: fix control clusters 2016-02-10 09:28:41 -02:00
s5k4ecgx.c [media] media framework: rename pads init function to media_entity_pads_init() 2016-01-11 12:19:03 -02:00
s5k5baf.c [media] s5k5baf: Check v4l2_of_parse_endpoint() return value 2016-02-01 10:02:40 -02:00
s5k6a3.c [media] s5k6a3: Fix VIDIOC_SUBDEV_G_FMT ioctl for TRY format 2016-01-25 10:28:25 -02:00
s5k6aa.c [media] media framework: rename pads init function to media_entity_pads_init() 2016-01-11 12:19:03 -02:00
saa711x_regs.h
saa717x.c
saa6588.c
saa6752hs.c
saa7110.c
saa7115.c [media] i2c: saa7115: Support CJC7113 detection 2016-05-06 15:52:51 -03:00
saa7127.c
saa7185.c
smiapp-pll.c
smiapp-pll.h
sony-btf-mpx.c
sr030pc30.c
tc358743.c [media] tc358743: drop bogus comment 2016-04-25 08:13:43 -03:00
tc358743_regs.h
tda7432.c
tda9840.c
tea6415c.c
tea6415c.h
tea6420.c
tea6420.h
ths7303.c [media] media: i2c: ths7303: remove redundant assignment on bt 2016-05-07 11:47:12 -03:00
ths8200.c
ths8200_regs.h
tlv320aic23b.c
tvaudio.c
tvp514x.c [media] tvp514x: Check v4l2_of_parse_endpoint() return value 2016-02-01 10:03:09 -02:00
tvp514x_regs.h
tvp5150.c [media] tvp5150: propagate I2C write error in .s_register callback 2016-05-09 14:44:38 -03:00
tvp5150_reg.h
tvp7002.c [media] tvp7002: Check v4l2_of_parse_endpoint() return value 2016-02-01 10:03:33 -02:00
tvp7002_reg.h
tw2804.c
tw9903.c
tw9906.c
uda1342.c
upd64031a.c
upd64083.c
vp27smpx.c
vpx3220.c [media] vpx3220: signedness bug in vpx3220_fp_read() 2016-02-01 07:59:43 -02:00
vs6624.c
vs6624_regs.h
wm8739.c
wm8775.c