Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: sdhci-pci-o2micro: Add missing checks in sdhci_pci_o2_probe

It's odd to adopt different error handling on failure of
pci_read_config_dword(). Check the return value and terminate
execution flow on failure of all pci_read_config_dword() calls
in this function.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Link: https://lore.kernel.org/r/20210226084146.29095-1-dinghao.liu@zju.edu.cn
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Dinghao Liu and committed by
Ulf Hansson
d599005a f46b54cc

+8
+8
drivers/mmc/host/sdhci-pci-o2micro.c
··· 706 706 ret = pci_read_config_dword(chip->pdev, 707 707 O2_SD_FUNC_REG0, 708 708 &scratch_32); 709 + if (ret) 710 + return ret; 709 711 scratch_32 = ((scratch_32 & 0xFF000000) >> 24); 710 712 711 713 /* Check Whether subId is 0x11 or 0x12 */ ··· 718 716 ret = pci_read_config_dword(chip->pdev, 719 717 O2_SD_FUNC_REG4, 720 718 &scratch_32); 719 + if (ret) 720 + return ret; 721 721 722 722 /* Enable Base Clk setting change */ 723 723 scratch_32 |= O2_SD_FREG4_ENABLE_CLK_SET; ··· 799 795 800 796 ret = pci_read_config_dword(chip->pdev, 801 797 O2_SD_PLL_SETTING, &scratch_32); 798 + if (ret) 799 + return ret; 802 800 803 801 if ((scratch_32 & 0xff000000) == 0x01000000) { 804 802 scratch_32 &= 0x0000FFFF; ··· 818 812 ret = pci_read_config_dword(chip->pdev, 819 813 O2_SD_FUNC_REG4, 820 814 &scratch_32); 815 + if (ret) 816 + return ret; 821 817 scratch_32 |= (1 << 22); 822 818 pci_write_config_dword(chip->pdev, 823 819 O2_SD_FUNC_REG4, scratch_32);