OpenCloudOS-Kernel/drivers/clk/tegra
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
..
Kconfig clk: tegra: EMC clock driver depends on EMC driver 2015-05-13 15:17:13 +02:00
Makefile clk: tegra: Add fixed factor peripheral clock type 2016-04-28 12:41:47 +02:00
clk-audio-sync.c clk: tegra: Remove CLK_IS_ROOT 2016-03-02 17:47:19 -08:00
clk-dfll.c clk: tegra: dfll: Reference CVB table instead of copying data 2016-04-28 12:41:53 +02:00
clk-dfll.h clk: tegra: dfll: Properly clean up on failure and removal 2016-04-28 12:41:54 +02:00
clk-divider.c tegra/clk-divider: fix wrong do_div() usage 2015-11-16 12:37:55 -05:00
clk-emc.c clk: tegra: Add missing of_node_put() 2016-02-02 15:49:28 +01:00
clk-id.h clk: tegra: Add sor_safe clock 2016-04-28 12:41:50 +02:00
clk-periph-fixed.c clk: tegra: Add fixed factor peripheral clock type 2016-04-28 12:41:47 +02:00
clk-periph-gate.c clk: tegra: Constify peripheral clock registers 2016-04-28 12:41:45 +02:00
clk-periph.c clk: tegra: Constify peripheral clock registers 2016-04-28 12:41:45 +02:00
clk-pll-out.c clk: tegra: Properly include clk.h 2015-07-20 11:11:17 -07:00
clk-pll.c clk: tegra: Fix pllre Tegra210 and add pll_re_out1 2016-04-28 12:41:50 +02:00
clk-super.c clk: tegra: Properly include clk.h 2015-07-20 11:11:17 -07:00
clk-tegra-audio.c clk: tegra: Modify tegra_audio_clk_init to accept more plls 2015-10-20 13:56:55 +02:00
clk-tegra-fixed.c clk: tegra: Remove trailing blank line 2016-04-28 12:41:45 +02:00
clk-tegra-periph.c clk: tegra: dpaux and dpaux1 are fixed factor clocks 2016-04-28 12:41:49 +02:00
clk-tegra-pmc.c clk: tegra: Properly include clk.h 2015-07-20 11:11:17 -07:00
clk-tegra-super-gen4.c clk: tegra: super: Fix sparse warnings for functions not declared as static 2016-02-02 15:49:34 +01:00
clk-tegra20.c treewide: Fix typos in printk 2016-04-28 10:52:28 +02:00
clk-tegra30.c clk: tegra: Fix PLL_U post divider and initial rate on Tegra30 2016-04-28 12:41:52 +02:00
clk-tegra114.c clk: tegra: Special-case mipi-cal parent on Tegra114 2016-04-28 12:41:46 +02:00
clk-tegra124-dfll-fcpu.c clk: tegra: dfll: Reformat CVB frequency table 2016-04-28 12:41:54 +02:00
clk-tegra124.c clk: tegra: dpaux and dpaux1 are fixed factor clocks 2016-04-28 12:41:49 +02:00
clk-tegra210.c remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00
clk.c clk: tegra: Changes for v4.7-rc1 2016-05-02 16:53:02 -07:00
clk.h clk: tegra: Fix pllre Tegra210 and add pll_re_out1 2016-04-28 12:41:50 +02:00
cvb.c clk: tegra: dfll: Properly clean up on failure and removal 2016-04-28 12:41:54 +02:00
cvb.h clk: tegra: dfll: Properly clean up on failure and removal 2016-04-28 12:41:54 +02:00