kernel-ark/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 clk: at91: fix check of clk_register() returned value 2016-04-15 16:57:09 -07:00
axis clk: add artpec-6 clock controller 2016-04-15 16:02:16 -07:00
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 clk: h8300: Properly cast to __iomem pointer 2016-02-26 16:01:32 -08:00
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 clk: meson: Remove CLK_IS_ROOT 2016-04-15 16:49:59 -07:00
microchip CLK: microchip: Add Microchip PIC32 clock driver. 2016-05-13 15:30:25 +02:00
mmp clk: mmp: Remove CLK_IS_ROOT 2016-04-15 16:50:01 -07:00
mvebu clk: mvebu: new driver for Armada CP110 system controller 2016-05-06 15:27:02 -07:00
mxs clk: mxs: Remove CLK_IS_ROOT 2016-03-02 17:44:59 -08:00
nxp clk: nxp: lpc18xx: Initialize clk_init_data::flags to 0 2016-05-06 10:55:11 -07:00
pistachio
pxa The clk changes for this release cycle are mostly dominated by 2016-03-23 06:06:45 -07:00
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 Merge branch 'for-v4.7/clk/exynos542x' into for-v4.7/clk/next 2016-04-15 18:57:00 +02:00
sirf clk: sirf: Remove CLK_IS_ROOT 2016-04-15 16:50:04 -07:00
socfpga clk: socfpga: allow for multiple parents on Arria10 periph clocks 2016-02-22 14:17:37 -08:00
spear clk: spear: Remove CLK_IS_ROOT 2016-03-02 17:46:55 -08:00
st clk: st: Remove impossible check for of_clk_get_parent_count() < 0 2016-02-26 16:01:32 -08:00
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 clk: ux500: Remove CLK_IS_ROOT 2016-03-02 17:48:03 -08:00
versatile clk: versatile: Remove CLK_IS_ROOT 2016-03-15 15:19:21 -07:00
x86 clk: x86: Remove clkdev.h and clk.h includes 2016-03-03 11:27:26 -08:00
zte clk: zte: Remove CLK_IS_ROOT 2016-04-15 16:50:07 -07:00
zynq clk: zynq: Remove CLK_IS_ROOT 2016-03-02 17:48:26 -08:00
clk-asm9260.c
clk-axi-clkgen.c clk: axi-clkgen: Remove sometimes impossible check 2016-01-29 17:11:02 -08:00
clk-axm5516.c
clk-cdce706.c
clk-cdce925.c
clk-clps711x.c clk: clps711x: Remove CLK_IS_ROOT 2016-04-15 16:50:09 -07:00
clk-composite.c Merge branch 'clk-hw-register' (early part) into clk-next 2016-04-21 14:47:18 -07:00
clk-conf.c
clk-cs2000-cp.c
clk-devres.c
clk-divider.c clk: divider: Add hw based registration APIs 2016-04-19 16:55:01 -07:00
clk-efm32gg.c clk: efm32gg: Remove CLK_IS_ROOT 2016-03-02 17:48:47 -08:00
clk-fixed-factor.c clk: fixed-factor: Add hw based registration APIs 2016-04-19 16:56:28 -07:00
clk-fixed-rate.c clk: fixed-rate: Add hw based registration APIs 2016-04-19 16:57:12 -07:00
clk-fractional-divider.c clk: fractional-divider: Add hw based registration APIs 2016-04-19 16:56:28 -07:00
clk-gate.c clk: gate: Add hw based registration APIs 2016-04-19 16:55:01 -07:00
clk-gpio.c clk: gpio: Add hw based registration APIs 2016-04-19 16:56:28 -07:00
clk-highbank.c
clk-ls1x.c clk: ls1x: Remove CLK_IS_ROOT 2016-04-15 16:50:10 -07:00
clk-max77686.c clk: max77{686,802}: Remove CLK_IS_ROOT 2016-03-15 15:19:49 -07:00
clk-max77802.c clk: max77{686,802}: Remove CLK_IS_ROOT 2016-03-15 15:19:49 -07:00
clk-max-gen.c
clk-max-gen.h
clk-mb86s7x.c clk: mb86s7x: Remove CLK_IS_ROOT 2016-03-03 11:27:48 -08:00
clk-moxart.c
clk-multiplier.c clk: move the common clock's to_clk_*(_hw) macros to clk-provider.h 2016-01-29 12:59:50 -08:00
clk-mux.c clk: mux: Add hw based registration APIs 2016-04-19 16:55:01 -07:00
clk-nomadik.c
clk-nspire.c clk: nspire: Remove CLK_IS_ROOT 2016-04-15 16:50:12 -07:00
clk-oxnas.c clk: Add Oxford Semiconductor OXNAS Standard Clocks 2016-04-21 14:20:07 -07:00
clk-palmas.c clk: palmas: Remove CLK_IS_ROOT 2016-04-15 16:50:14 -07:00
clk-pwm.c clk: pwm: Use pwm_get_args() where appropriate 2016-05-17 14:45:00 +02:00
clk-qoriq.c clk: qoriq: add __init attribute 2016-04-19 18:56:15 -07:00
clk-rk808.c clk: rk808: Remove CLK_IS_ROOT 2016-04-15 16:50:18 -07:00
clk-s2mps11.c clk: s2mps11: Remove CLK_IS_ROOT 2016-03-02 17:50:32 -08:00
clk-scpi.c clk: scpi: Remove CLK_IS_ROOT 2016-03-02 17:50:58 -08:00
clk-si514.c clk: si5{14,351,70}: Remove CLK_IS_ROOT 2016-03-02 17:51:13 -08:00
clk-si570.c clk: si5{14,351,70}: Remove CLK_IS_ROOT 2016-03-02 17:51:13 -08:00
clk-si5351.c clk: si5{14,351,70}: Remove CLK_IS_ROOT 2016-03-02 17:51:13 -08:00
clk-si5351.h
clk-stm32f4.c
clk-tango4.c clk: tango4: improve clkgen driver 2016-04-15 17:16:06 -07:00
clk-twl6040.c clk: twl6040: Remove CLK_IS_ROOT 2016-04-15 16:50:21 -07:00
clk-u300.c
clk-vt8500.c clk: vt8500: don't return possibly uninitialized data 2016-02-02 11:53:17 -08:00
clk-wm831x.c clk: wm831x: Remove CLK_IS_ROOT 2016-04-15 16:50:23 -07:00
clk-xgene.c clk: xgene: Remove CLK_IS_ROOT 2016-04-15 16:50:27 -07:00
clk.c clk: fix critical clock locking 2016-05-19 14:09:30 -07:00
clk.h
clkdev.c clkdev: Add clk_hw based registration APIs 2016-04-19 16:54:26 -07:00
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