kernel_optimize_test/drivers/media/platform
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
..
am437x [media] am437x-vpfe: fix an uninitialized variable bug 2016-04-13 17:09:55 -03:00
blackfin
coda media updates for v4.6-rc1 2016-03-16 18:27:32 -07:00
davinci [media] davinci: ccdc_update_raw_params() frees the wrong thing 2016-01-25 15:15:26 -02:00
exynos4-is Linux 4.6-rc7 2016-05-09 12:21:49 -03:00
exynos-gsc [media] exynos-gsc: avoid build warning without CONFIG_OF 2016-05-09 18:38:33 -03:00
marvell-ccic
omap
omap3isp [media] media: Rename is_media_entity_v4l2_io to is_media_entity_v4l2_video_device 2016-04-13 17:20:48 -03:00
s3c-camif [media] media: s3c-camif: fix deadlock on driver probe() 2016-05-02 10:39:58 -03:00
s5p-g2d [media] s5p-g2d: remove non-device-tree init code 2016-04-13 16:25:17 -03:00
s5p-jpeg [media] s5p-jpeg: Adjust buffer size for Exynos 4412 2016-04-13 16:24:15 -03:00
s5p-mfc [media] s5p-mfc: remove non-device-tree init code 2016-04-13 16:25:43 -03:00
s5p-tv remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00
soc_camera [media] soc_camera: rcar_vin: add R-Car Gen 2 and 3 fallback compatibility strings 2016-04-13 17:17:56 -03:00
sti [media] c8sectpfe: Rework firmware loading mechanism 2016-05-09 12:57:54 -03:00
ti-vpe [media] media: ti-vpe: cal: Fix warning: variable dereference before being checked 2016-02-23 07:17:27 -03:00
vivid [media] tpg: Export the tpg code from vivid as a module 2016-04-20 16:14:39 -03:00
vsp1 [media] v4l: vsp1: Update WPF and LIF maximum sizes for Gen3 2016-04-13 19:16:10 -03:00
xilinx [media] xilinx-vipp: remove unnecessary of_node_put 2016-05-07 11:45:38 -03:00
arv.c
fsl-viu.c
Kconfig [media] media: platform: rcar_jpu, vsp1: Use ARCH_RENESAS 2016-04-13 19:16:41 -03:00
m2m-deinterlace.c
Makefile [media] timblogiw: move to staging in preparation for removal 2016-02-19 08:10:33 -02:00
mx2_emmaprp.c
rcar_jpu.c [media] rcar_jpu: Add R-Car Gen2 Fallback Compatibility String 2016-02-01 09:48:19 -02:00
sh_veu.c
sh_vou.c
via-camera.c
via-camera.h
vim2m.c [media] vim2m: return error if driver registration fails 2016-02-01 07:37:46 -02:00