android_kernel_motorola_sm6225/drivers/irqchip
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
..
alphascale_asm9260-icoll.h irqchip/mxs: Add Alphascale ASM9260 support 2015-10-14 09:37:47 +02:00
exynos-combiner.c irqdomain: Use irq_domain_get_of_node() instead of direct field access 2015-10-13 19:01:23 +02:00
irq-alpine-msi.c irqchip/irq-alpine-msi: Don't use <asm-generic/msi.h> 2016-05-11 10:12:25 +01:00
irq-armada-370-xp.c irqchip/armada-370-xp: Allow allocation of multiple MSIs 2016-02-16 17:36:16 +00:00
irq-ath79-cpu.c irqchip/ath79-cpu: Move the CPU IRQ driver from arch/mips/ath79/ 2016-02-17 13:47:19 +00:00
irq-ath79-misc.c irqchip/ath79-misc: Move the MISC driver from arch/mips/ath79/ 2016-02-17 13:44:31 +00:00
irq-atmel-aic-common.c irqchip/atmel-aic: Change return type of aic_common_set_priority() 2016-02-08 15:03:42 +01:00
irq-atmel-aic-common.h irqchip/atmel-aic: Change return type of aic_common_set_priority() 2016-02-08 15:03:42 +01:00
irq-atmel-aic.c irqchip/atmel-aic: Change return type of aic_common_set_priority() 2016-02-08 15:03:42 +01:00
irq-atmel-aic5.c irqchip/atmel-aic: Remove duplicate bit operation 2016-02-08 15:03:42 +01:00
irq-bcm2835.c irqchip: Kill off set_irq_flags usage 2015-09-16 16:53:38 +02:00
irq-bcm2836.c irqchip/bcm2836: Use a more generic memory barrier call 2016-05-11 10:13:00 +01:00
irq-bcm6345-l1.c irqchips/bmips: Add bcm6345-l1 interrupt controller 2016-02-08 15:03:42 +01:00
irq-bcm7038-l1.c genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
irq-bcm7120-l2.c genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
irq-brcmstb-l2.c genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
irq-clps711x.c remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00
irq-crossbar.c irqchip: Mask the non-type/sense bits when translating an IRQ 2016-05-11 10:12:41 +01:00
irq-digicolor.c irqchip: Prepare for local stub header removal 2015-07-11 23:14:23 +02:00
irq-dw-apb-ictl.c genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
irq-eznps.c irqchip: add nps Internal and external irqchips 2016-05-09 09:32:31 +05:30
irq-gic-common.c Small release overall. 2016-05-19 11:27:09 -07:00
irq-gic-common.h irqchip/gic-v2: Parse and export virtual GIC information 2016-05-03 12:54:21 +02:00
irq-gic-realview.c irqchip/gic/realview: Support more RealView DCC variants 2016-03-09 09:38:05 +00:00
irq-gic-v2m.c irqchip/gic-v2m: Add workaround for Broadcom NS2 GICv2m erratum 2016-05-11 10:12:40 +01:00
irq-gic-v3-its-pci-msi.c irqchip/gic-v3-its: Add handling of PCI requester id. 2015-10-16 13:07:13 +01:00
irq-gic-v3-its-platform-msi.c irqchip/gic-v3-its: Parse new version of msi-parent property 2015-10-16 13:07:15 +01:00
irq-gic-v3-its.c irqchip/gicv3-its: Don't allow devices whose ID is outside range 2016-05-11 10:12:12 +01:00
irq-gic-v3.c Small release overall. 2016-05-19 11:27:09 -07:00
irq-gic.c remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00
irq-hip04.c remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00
irq-i8259.c irqchip/i8259: Convert to use irq_set_chained_handler_and_data 2015-10-01 16:32:54 +02:00
irq-imgpdc.c genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
irq-imx-gpcv2.c irqchip: Convert all alloc/xlate users from of_node to fwnode 2015-10-13 19:01:23 +02:00
irq-ingenic.c irqchip: Prepare for local stub header removal 2015-07-11 23:14:23 +02:00
irq-keystone.c irqchip: Kill off set_irq_flags usage 2015-09-16 16:53:38 +02:00
irq-lpc32xx.c irqchip: Add LPC32xx interrupt controller driver 2016-05-11 10:12:11 +01:00
irq-ls-scfg-msi.c irqchip: Add Layerscape SCFG MSI controller support 2016-05-04 09:58:04 +01:00
irq-mbigen.c irqchip/mbigen: Checking for IS_ERR() instead of NULL 2016-05-11 10:12:13 +01:00
irq-metag-ext.c genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
irq-metag.c genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
irq-mips-cpu.c irqchip: Prepare for local stub header removal 2015-07-11 23:14:23 +02:00
irq-mips-gic.c irqchip: mips-gic: Provide VP ID accessor 2016-05-13 14:01:49 +02:00
irq-mmp.c irqchip: Kill off set_irq_flags usage 2015-09-16 16:53:38 +02:00
irq-moxart.c irqchip: Prepare for local stub header removal 2015-07-11 23:14:23 +02:00
irq-mtk-sysirq.c irqchip: Convert all alloc/xlate users from of_node to fwnode 2015-10-13 19:01:23 +02:00
irq-mvebu-odmi.c irqchip/gic: Return IRQ_SET_MASK_OK_DONE in the set_affinity method 2016-02-19 15:42:29 +00:00
irq-mxs.c irqchip/mxs: Fix error check of of_io_request_and_map() 2016-03-10 16:03:30 +01:00
irq-nvic.c irqchip: Convert all alloc/xlate users from of_node to fwnode 2015-10-13 19:01:23 +02:00
irq-omap-intc.c irqchip/omap-intc: Add support for spurious irq handling 2016-01-06 11:35:13 +01:00
irq-or1k-pic.c irqchip: Prepare for local stub header removal 2015-07-11 23:14:23 +02:00
irq-orion.c genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
irq-partition-percpu.c irqchip: Add per-cpu interrupt partitioning library 2016-05-02 13:42:51 +02:00
irq-pic32-evic.c IRQCHIP: irq-pic32-evic: Add support for PIC32 interrupt controller 2016-01-24 02:52:20 +01:00
irq-renesas-h8s.c irqchip: renesas-h8s: Replace ctrl_outw/ctrl_inw with writew/readw 2016-01-20 22:44:13 +09:00
irq-renesas-h8300h.c h8300: Rename ctlr_out/in[bwl] to raw_read/write[bwl] 2015-12-15 10:12:03 +01:00
irq-renesas-intc-irqpin.c irqchip/renesas-intc-irqpin: Improve clock error handling and reporting 2015-11-24 16:54:19 +00:00
irq-renesas-irqc.c irqchip/renesas-irqc: Move over to nested generic chip 2015-09-29 20:41:00 +02:00
irq-s3c24xx.c irqchip/s3c24xx: Mark init_eint as __maybe_unused 2016-01-26 16:00:14 +01:00
irq-sa11x0.c ARM: kill off set_irq_flags usage 2015-07-28 13:58:13 +02:00
irq-sirfsoc.c irqchip: Prepare for local stub header removal 2015-07-11 23:14:23 +02:00
irq-st.c irqchip: st: Supply new driver for STi based devices 2015-03-03 19:48:53 +00:00
irq-sun4i.c irqchip/sun4i: Fix compilation outside of arch/arm 2016-02-02 15:46:40 +01:00
irq-sunxi-nmi.c irqchip/sunxi-nmi: Fix error check of of_io_request_and_map() 2016-03-10 16:03:30 +01:00
irq-tango.c irqchip/tango: Add support for Sigma Designs SMP86xx/SMP87xx interrupt controller 2016-02-18 01:18:14 +00:00
irq-tb10x.c genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
irq-tegra.c irqchip: Mask the non-type/sense bits when translating an IRQ 2016-05-11 10:12:41 +01:00
irq-ts4800.c irqchip/ts4800: Make ts4800_ic_ops static const 2016-02-18 02:09:18 +00:00
irq-versatile-fpga.c irqchip: versatile-fpga: add new compatible for OX810SE SoC 2016-04-26 09:50:51 +02:00
irq-vf610-mscm-ir.c irqchip: Convert all alloc/xlate users from of_node to fwnode 2015-10-13 19:01:23 +02:00
irq-vic.c irqchip: Kill off set_irq_flags usage 2015-09-16 16:53:38 +02:00
irq-vt8500.c irqchip: Kill off set_irq_flags usage 2015-09-16 16:53:38 +02:00
irq-xtensa-mx.c irqchip: Prepare for local stub header removal 2015-07-11 23:14:23 +02:00
irq-xtensa-pic.c irqchip: Prepare for local stub header removal 2015-07-11 23:14:23 +02:00
irq-zevio.c irqchip/zevio: Use irq_data_get_chip_type() helper 2015-12-30 18:29:02 +01:00
irqchip.c irqchip / GIC: Convert the GIC driver to ACPI probing 2015-10-01 02:18:38 +02:00
Kconfig irqchip: nps: add 64BIT dependency 2016-05-20 10:20:47 -07:00
Makefile ARC updates for 4.7-rc1 2016-05-19 09:46:18 -07:00
spear-shirq.c remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00