WSL2-Linux-Kernel/drivers/clk
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
..
at91
axis
axs10x clk/axs10x: Add I2S PLL clock driver 2016-05-06 10:35:04 -07:00
bcm clk: bcm/kona: Do not use sizeof on pointer type 2016-05-06 11:06:44 -07:00
berlin
h8300
hisilicon clk: hisilicon: add CRG driver for hi3519 soc 2016-05-06 11:13:32 -07:00
imx Merge tag 'imx-clk-fixes-4.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into clk-next 2016-05-12 14:48:26 -07:00
ingenic clk: ingenic: Allow divider value to be divided 2016-05-12 14:48:25 -07:00
keystone
mediatek clk: mediatek: remove hdmitx_dig_cts from TOP clocks 2016-05-06 17:47:42 +02:00
meson
microchip CLK: microchip: Add Microchip PIC32 clock driver. 2016-05-13 15:30:25 +02:00
mmp
mvebu clk: mvebu: new driver for Armada CP110 system controller 2016-05-06 15:27:02 -07:00
mxs
nxp clk: nxp: lpc18xx: Initialize clk_init_data::flags to 0 2016-05-06 10:55:11 -07:00
pistachio
pxa
qcom clk: qcom: mmcc-8996: Remove clocks that should be controlled by RPM 2016-05-12 14:48:28 -07:00
renesas clk: renesas: cpg-mssr: Use always-on governor for Clock Domain 2016-04-28 10:32:55 +02:00
rockchip Merge tag 'v4.7-rockchip-clk4' of git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip into clk-next 2016-05-12 14:48:22 -07:00
samsung
sirf
socfpga
spear
st
sunxi clk: sunxi: Add display and TCON0 clocks driver 2016-05-12 14:47:52 -07:00
tegra remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00
ti It's the usual big pile of driver updates and additions, but we 2016-05-20 20:18:12 -07:00
ux500
versatile
x86
zte
zynq
Kconfig It's the usual big pile of driver updates and additions, but we 2016-05-20 20:18:12 -07:00
Makefile It's the usual big pile of driver updates and additions, but we 2016-05-20 20:18:12 -07:00
clk-asm9260.c
clk-axi-clkgen.c
clk-axm5516.c
clk-cdce706.c
clk-cdce925.c
clk-clps711x.c
clk-composite.c
clk-conf.c
clk-cs2000-cp.c
clk-devres.c
clk-divider.c
clk-efm32gg.c
clk-fixed-factor.c
clk-fixed-rate.c
clk-fractional-divider.c
clk-gate.c
clk-gpio.c
clk-highbank.c
clk-ls1x.c
clk-max-gen.c
clk-max-gen.h
clk-max77686.c
clk-max77802.c
clk-mb86s7x.c
clk-moxart.c
clk-multiplier.c
clk-mux.c
clk-nomadik.c
clk-nspire.c
clk-oxnas.c
clk-palmas.c
clk-pwm.c clk: pwm: Use pwm_get_args() where appropriate 2016-05-17 14:45:00 +02:00
clk-qoriq.c
clk-rk808.c
clk-s2mps11.c
clk-scpi.c
clk-si514.c
clk-si570.c
clk-si5351.c
clk-si5351.h
clk-stm32f4.c
clk-tango4.c
clk-twl6040.c
clk-u300.c
clk-vt8500.c
clk-wm831x.c
clk-xgene.c
clk.c clk: fix critical clock locking 2016-05-19 14:09:30 -07:00
clk.h
clkdev.c