WSL2-Linux-Kernel/drivers/dma
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
..
bestcomm dmaengine: constify of_device_id array 2015-03-18 22:13:14 +05:30
dw dmaengine: dw: pass platform data via struct dw_dma_chip 2016-05-02 15:31:05 +05:30
hsu dmaengine updates for 4.7 2016-05-19 11:47:18 -07:00
ioat dmaengine: ioatdma: disable relaxed ordering for ioatdma 2016-05-14 13:36:52 +05:30
ipu genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
ppc4xx dmaengine: Remove FSF mailing addresses 2015-03-16 22:28:15 +05:30
qcom dmaengine: qcom_hidma: add support for object hierarchy 2016-05-14 11:54:45 +05:30
sh dmaengine: rcar-dmac: clear pertinence number of channels 2016-03-03 21:51:14 +05:30
xilinx dmaengine updates for 4.7 2016-05-19 11:47:18 -07:00
Kconfig Merge branch 'topic/xilinx' into for-linus 2016-05-17 10:15:34 +05:30
Makefile dmaengine: tegra-adma: Add support for Tegra210 ADMA 2016-05-13 14:56:24 +05:30
TODO
acpi-dma.c dmaengine: acpi-dma: align debug message with flow 2016-02-22 09:06:09 +05:30
amba-pl08x.c dmaengine: pl08x: allocate OF slave channel data at probe time 2016-04-05 16:53:41 -07:00
at_hdmac.c dmaengine: at_hdmac: use %pad format string for dma_addr_t 2015-11-16 09:21:05 +05:30
at_hdmac_regs.h dmaengine: at_hdmac: use %pad format string for dma_addr_t 2015-11-16 09:21:05 +05:30
at_xdmac.c dmaengine: at_xdmac: fix residue computation 2016-03-10 16:32:36 +05:30
bcm2835-dma.c dmaengine: bcm2835: fix typo/added newline in legacy-mode warning message 2016-05-02 15:08:19 +05:30
coh901318.c dmaengine: Add an enum for the dmaengine alignment constraints 2015-08-05 10:53:52 +05:30
coh901318.h
coh901318_lli.c
cppi41.c dmaengine: cppi41: add missing bitfields 2015-04-11 21:12:58 +05:30
dma-axi-dmac.c dmaengine: axi_dmac: Add synchronization support 2015-11-16 08:28:52 +05:30
dma-jz4740.c Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2015-04-24 09:49:37 -07:00
dma-jz4780.c dmaengine: jz4780: Kill tasklets before unregistering the device 2015-08-18 22:28:50 +05:30
dmaengine.c Merge branch 'topic/core' into for-linus 2016-05-17 10:13:40 +05:30
dmaengine.h
dmatest.c kernel/params: constify struct kernel_param_ops uses 2015-05-28 11:32:10 +09:30
edma.c dmaengine updates for 4.7 2016-05-19 11:47:18 -07:00
ep93xx_dma.c dmaengine: ep93xx: Treat STALL and NFB IRQs same way 2016-01-25 09:49:55 +05:30
fsl-edma.c dmaengine: fsl-edma: add PM suspend/resume support 2015-12-05 15:52:13 +05:30
fsl_raid.c dmaengine: fsl_raid: statify fsl_re_chan_probe 2015-04-02 16:11:35 +05:30
fsl_raid.h dmaengine: Driver support for FSL RaidEngine device. 2015-04-02 16:10:27 +05:30
fsldma.c dmaengine: fsldma: Use dma_pool_zalloc 2016-05-03 12:23:25 +05:30
fsldma.h dmaengine: fsldma: declare slave capabilities for the generic code 2015-01-13 23:58:08 +05:30
idma64.c dmaengine: idma64: clear LLP_[SD]_EN bits in last descriptor 2016-02-15 22:06:45 +05:30
idma64.h asm-generic changes for 4.6 2016-03-24 23:13:48 -07:00
img-mdc-dma.c dmaengine: mdc: Correct terminate_all handling 2015-12-18 11:12:29 +05:30
imx-dma.c dmaengine: Add an enum for the dmaengine alignment constraints 2015-08-05 10:53:52 +05:30
imx-sdma.c dmaengine: imx-sdma: remove __init annotation on sdma_event_remap 2015-11-16 09:14:25 +05:30
iop-adma.c dma, mm/pat: Rename dma_*_writecombine() to dma_*_wc() 2016-03-09 14:57:51 +01:00
k3dma.c dmaengine: Add an enum for the dmaengine alignment constraints 2015-08-05 10:53:52 +05:30
lpc18xx-dmamux.c dmaengine: add driver for lpc18xx dmamux 2015-08-18 22:12:14 +05:30
mic_x100_dma.c dma/mic_x100_dma: IS_ERR() vs PTR_ERR() typo 2016-03-03 21:13:01 +05:30
mic_x100_dma.h dmaengine: Add an enum for the dmaengine alignment constraints 2015-08-05 10:53:52 +05:30
mmp_pdma.c dmaengine: mmp_pdma: Use dma_pool_zalloc 2016-05-03 12:23:11 +05:30
mmp_tdma.c dmaengine: Add an enum for the dmaengine alignment constraints 2015-08-05 10:53:52 +05:30
moxart-dma.c dmaengine: moxart-dma: Fix module autoload for OF platform driver 2015-10-01 07:34:31 +05:30
mpc512x_dma.c dmaengine: mpc512x: Fix code style 2016-04-04 09:50:10 -07:00
mv_xor.c dmaengine: mv_xor: add support for Armada 3700 SoC 2016-05-03 12:27:47 +05:30
mv_xor.h dmaengine: mv_xor: use SoC type instead of directly the operation mode 2016-05-03 12:27:47 +05:30
mxs-dma.c dmaengine: mxs: Constify platform_device_id 2015-05-04 16:38:55 +05:30
nbpfaxi.c dmaengine: nbpfaxi: Constify platform_device_id 2015-05-04 16:38:55 +05:30
of-dma.c dmaengine: of_dma: approximate an average distribution 2016-05-14 13:34:10 +05:30
omap-dma.c dmaengine: omap-dma: Do not suppress interrupts for memcpy 2016-04-05 09:09:42 -07:00
pch_dma.c dmaengine: Remove remaining FSF mailing addresses 2015-07-06 19:18:53 +05:30
pl330.c dmaengine: pl330: fix to support the burst mode 2016-03-01 09:11:25 +05:30
pxa_dma.c dmaengine: pxa_dma: remove duplicate const qualifier 2016-04-26 21:59:46 +05:30
s3c24xx-dma.c dmaengine: s3c24xx: Constify platform_device_id 2015-05-04 16:38:55 +05:30
sa11x0-dma.c dmaengine: sa11x0: report slave capabilities to upper layers 2015-04-17 23:24:35 +05:30
sirf-dma.c dmaengine: sirf: use __maybe_unused to hide pm functions 2016-03-04 20:31:35 +05:30
ste_dma40.c ste_dma40: Delete an unnecessary variable initialisation in d40_probe() 2015-12-10 09:17:10 +05:30
ste_dma40_ll.c
ste_dma40_ll.h
stm32-dma.c dmaengine: stm32-dma: Fix unchecked deference of chan->desc 2015-12-10 09:45:22 +05:30
sun4i-dma.c remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00
sun6i-dma.c dmaengine: sun6i: Add cyclic capability 2016-05-02 15:59:02 +05:30
tegra20-apb-dma.c dmaengine: tegra-apb: proper default init of channel slave_id 2016-05-02 15:23:56 +05:30
tegra210-adma.c dmaengine: tegra-adma: Add support for Tegra210 ADMA 2016-05-13 14:56:24 +05:30
ti-dma-crossbar.c dmaengine: ti-dma-crossbar: dra7: Support for reserving DMA event ranges 2015-11-30 15:09:16 +05:30
timb_dma.c dmaengine: Remove remaining FSF mailing addresses 2015-07-06 19:18:53 +05:30
txx9dmac.c
txx9dmac.h
virt-dma.c dmaengine: virt-dma: don't always free descriptor upon completion 2015-11-16 08:32:16 +05:30
virt-dma.h Merge branch 'topic/async' into for-linus 2016-01-06 15:17:47 +05:30
xgene-dma.c dmaengine: xgene-dma: Fix double IRQ issue by setting IRQ_DISABLE_UNLAZY flag 2016-01-07 11:09:36 +05:30
zx296702_dma.c dmaengine updates for 4.4-rc1 2015-11-10 10:05:17 -08:00