WSL2-Linux-Kernel/drivers/mmc/host
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 mmc: sh_mmcif: remove obsolete support for sh7372 2016-05-02 10:33:41 +02:00
Makefile mmc: sdhci-pic32: Add PIC32 SDHCI host controller driver 2016-02-29 11:03:12 +01:00
android-goldfish.c mmc: android-goldfish: remove incorrect __iomem annotation 2015-09-01 14:19:11 +02:00
atmel-mci.c mmc: atmel-mci: Remove redundant runtime PM calls 2016-05-02 10:33:20 +02:00
au1xmmc.c mmc: host: drop owner assignment from platform_drivers 2014-10-20 16:20:56 +02:00
bfin_sdh.c mmc: bfin_sdh: remove the MMC_DATA_STREAM flag 2016-02-29 11:02:59 +01:00
cb710-mmc.c mmc: cb710: Move away from using deprecated APIs 2013-10-30 20:26:37 -04:00
cb710-mmc.h mmc: cb710: use to_platform_device() 2016-01-05 18:04:57 +01:00
davinci_mmc.c mmc: davinci: prepare clock 2016-05-02 10:33:19 +02:00
dw_mmc-exynos.c mmc: dw_mmc-exynos: remove dw_mci_exynos_setup_clock 2016-05-02 10:33:18 +02:00
dw_mmc-exynos.h mmc: dw_mmc: exynos: Support eMMC's HS400 mode 2015-03-23 14:13:28 +01:00
dw_mmc-k3.c mmc: dw_mmc: k3: Fix modalias to make module auto-loading work 2015-06-01 09:07:05 +02:00
dw_mmc-pci.c mmc: dw_mmc-pci: Remove superflous #else condition on CONFIG_PM_SLEEP 2014-09-09 13:59:05 +02:00
dw_mmc-pltfm.c mmc: dw_mmc: remove the prepare_command hook 2016-02-29 11:03:09 +01:00
dw_mmc-pltfm.h mmc: remove use of __devexit 2012-11-28 12:28:18 -08:00
dw_mmc-rockchip.c mmc: dw_mmc: rockchip: Set the drive phase properly 2016-05-23 11:45:47 +02:00
dw_mmc.c remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00
dw_mmc.h mmc: dw_mmc: remove setup_clock callback 2016-05-02 10:33:18 +02:00
jz4740_mmc.c mmc: jz4740_mmc: remove the MMC_DATA_STREAM flag 2016-02-29 11:03:00 +01:00
mmc_spi.c mmc: mmc_spi: Add Card Detect comments and fix CD GPIO case 2016-03-16 12:36:09 +01:00
mmci.c mmc: mmci: Remove redundant runtime PM calls 2016-05-02 10:33:21 +02:00
mmci.h mmc: mmci: Add Qcom specific rx_fifocnt logic. 2014-07-09 11:25:57 +02:00
mmci_qcom_dml.c mmc: mmci: Add qcom dml support to the driver. 2014-09-09 13:58:46 +02:00
mmci_qcom_dml.h mmc: mmci: Add qcom dml support to the driver. 2014-09-09 13:58:46 +02:00
moxart-mmc.c mmc: moxart: Fix module autoload for OF platform driver 2015-10-26 15:59:57 +01:00
mtk-sd.c mmc: mediatek: Remove redundant runtime PM calls 2016-05-02 10:33:21 +02:00
mvsdio.c mmc: mvsdio: delete platform data code path 2015-12-22 11:32:12 +01:00
mvsdio.h
mxcmmc.c mmc: mxcmmc: remove the MMC_DATA_STREAM flag 2016-02-29 11:03:00 +01:00
mxs-mmc.c mmc: mxs: Constify platform_device_id 2015-06-01 09:06:50 +02:00
of_mmc_spi.c mmc: of_mmc_spi: fix unused warning 2016-03-17 14:54:40 +01:00
omap.c mmc: omap: Use dma_request_chan() for requesting DMA channel 2016-05-04 13:12:00 +02:00
omap_hsmmc.c mmc: omap_hsmmc: Use dma_request_chan() for requesting DMA channel 2016-05-04 09:28:03 +02:00
pxamci.c mmc: pxamci: remove the MMC_DATA_STREAM flag 2016-02-29 11:03:01 +01:00
pxamci.h
rtsx_pci_sdmmc.c mmc: rtsx: Constify platform_device_id 2015-06-01 09:06:50 +02:00
rtsx_usb_sdmmc.c mmc: rtsx: Constify platform_device_id 2015-06-01 09:06:50 +02:00
s3cmci.c mmc: s3cmci: remove the MMC_DATA_STREAM flag 2016-02-29 11:03:01 +01:00
s3cmci.h mmc: s3cmci: port DMA code to dmaengine API 2014-07-09 11:26:13 +02:00
sdhci-acpi.c mmc: sdhci-acpi: Remove MMC_CAP_BUS_WIDTH_TEST for Intel controllers 2016-05-23 11:52:41 +02:00
sdhci-bcm-kona.c mmc: sdhci-bcm-kona: fix logic to check for 8-bit data width 2015-10-26 15:59:55 +01:00
sdhci-bcm2835.c mmc: sdhci-bcm2835: use sdhci_pltfm_init for private allocation 2016-02-29 11:03:25 +01:00
sdhci-cns3xxx.c mmc: sdhci: set the .remove to sdhci_pltfm_unregister() 2015-03-23 14:13:35 +01:00
sdhci-dove.c mmc: sdhci: set the .remove to sdhci_pltfm_unregister() 2015-03-23 14:13:35 +01:00
sdhci-esdhc-imx.c remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00
sdhci-esdhc.h mmc: sdhci-of-esdhc: support both BE and LE host controller 2015-10-26 16:00:08 +01:00
sdhci-iproc.c mmc: sdhci-iproc: use sdhci_pltfm_unregister directly 2016-02-29 11:02:55 +01:00
sdhci-msm.c mmc: sdhci-msm: use sdhci_pltfm_init for private allocation 2016-02-29 11:03:26 +01:00
sdhci-of-arasan.c mmc: sdhci-of-arasan: fix set_clock when a phy is supported 2016-05-04 13:12:36 +02:00
sdhci-of-at91.c remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00
sdhci-of-esdhc.c mmc: sdhci-of-esdhc: use sdhci_pltfm_init for private allocation 2016-02-29 11:03:28 +01:00
sdhci-of-hlwd.c mmc: sdhci: set the .remove to sdhci_pltfm_unregister() 2015-03-23 14:13:35 +01:00
sdhci-pci-core.c mmc: sdhci-pci: Remove MMC_CAP_BUS_WIDTH_TEST for Intel controllers 2016-05-23 11:52:40 +02:00
sdhci-pci-data.c mmc: sdhci-pci: Add support for drive strength selection for SPT 2015-06-01 09:07:14 +02:00
sdhci-pci-o2micro.c mmc: sdhci-pci: Make sdhci_pci_o2_fujin2_pci_init() static 2015-10-26 16:00:05 +01:00
sdhci-pci-o2micro.h mmc: sdhci-pci: Make sdhci_pci_o2_fujin2_pci_init() static 2015-10-26 16:00:05 +01:00
sdhci-pci.h mmc: sdhci-pci: Add support and PCI IDs for more Broxton host controllers 2016-04-05 12:14:09 +02:00
sdhci-pic32.c mmc: sdhci-pic32: remove owner assignment 2016-05-02 10:33:25 +02:00
sdhci-pltfm.c mmc: sdhci-pltfm: call platform_get_irq() before sdhci_alloc_host() 2016-05-02 10:33:34 +02:00
sdhci-pltfm.h mmc: sdhci-pltfm: remove priv variable from sdhci_pltfm_host 2016-02-29 11:03:30 +01:00
sdhci-pxav2.c mmc: sdhci-pxav2: remove unnecessary assignment of pltfm_host->priv 2016-02-29 11:03:30 +01:00
sdhci-pxav3.c mmc: sdhci: Fix regression setting power on Trats2 board 2016-03-29 12:46:13 +02:00
sdhci-s3c-regs.h mmc: sdhci-s3c: remove platform dependencies 2013-04-19 13:51:23 +02:00
sdhci-s3c.c mmc: sdhci-s3c: Constify platform_device_id 2015-06-01 09:06:52 +02:00
sdhci-sirf.c mmc: mmc: extend the mmc_send_tuning() 2015-10-27 10:38:41 +01:00
sdhci-spear.c Update Viresh Kumar's email address 2015-07-17 16:39:53 -07:00
sdhci-st.c mmc: sdhci-st: use sdhci_pltfm_init for private allocation 2016-02-29 11:03:29 +01:00
sdhci-tegra.c mmc: tegra: Disable UHS-I modes for Tegra124 2016-04-14 11:40:01 +02:00
sdhci.c remove lots of IS_ERR_VALUE abuses 2016-05-27 15:26:11 -07:00
sdhci.h mmc: sdhci: use IS_ENABLE(CONFIG_LEDS_CLASS) to enable LED struct members 2016-05-02 10:33:36 +02:00
sdhci_f_sdh30.c mmc: sdhci_f_sdh30: Fix the size passed to sdhci_alloc_host 2015-06-01 09:06:46 +02:00
sdricoh_cs.c mmc: sdricoh_cs: Less checks in sdricoh_init_mmc() after, error detection 2016-02-29 11:02:45 +01:00
sh_mmcif.c mmc: sh_mmci: Get rid of wrapper function for regulators 2016-05-02 10:33:09 +02:00
sh_mobile_sdhi.c mmc: sh_mobile_sdhi: enable SDIO IRQs for RCar Gen3 2016-05-16 11:31:27 +02:00
sunxi-mmc.c mmc: sunxi: Disable eMMC HS-DDR (MMC_CAP_1_8V_DDR) for Allwinner A80 2016-04-28 11:43:54 +02:00
tifm_sd.c mmc: Convert pr_warning to pr_warn 2014-09-24 10:13:09 +02:00
tmio_mmc.c mmc: TMIO: Use devm_request_irq() 2015-06-01 09:06:48 +02:00
tmio_mmc.h mmc: tmio: document CTL_STATUS handling 2016-05-02 10:36:03 +02:00
tmio_mmc_dma.c mmc: tmio: merge distributed include files 2016-05-02 10:33:40 +02:00
tmio_mmc_pio.c mmc: tmio/sdhi: introduce flag for RCar 2+ specific features 2016-05-04 09:28:04 +02:00
toshsd.c PM / Runtime: Move ignore_children flag under CONFIG_PM 2016-04-22 01:32:37 +02:00
toshsd.h mmc: add Toshiba PCI SD controller driver 2014-11-26 14:30:58 +01:00
usdhi6rol0.c mmc: usdhi6rol0: add pinctrl to set pin drive strength 2016-05-02 10:36:06 +02:00
ushc.c mmc: ushc: Fix incorrect parameter in sizeof 2014-02-25 15:42:20 -05:00
via-sdmmc.c mmc: via-sdmmc: Move away from using deprecated APIs 2013-10-30 20:28:36 -04:00
vub300.c mmc: vub300: Remove unneded semicolons 2015-10-26 15:59:54 +01:00
wbsd.c mmc: wbsd: Remove unneded semicolon 2015-10-26 15:59:53 +01:00
wbsd.h
wmt-sdmmc.c mmc: constify of_device_id array 2015-03-23 14:13:49 +01:00