Commit d599005a authored by Dinghao Liu's avatar Dinghao Liu Committed by Ulf Hansson

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: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
Link: https://lore.kernel.org/r/20210226084146.29095-1-dinghao.liu@zju.edu.cnSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent f46b54cc
...@@ -706,6 +706,8 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip) ...@@ -706,6 +706,8 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
ret = pci_read_config_dword(chip->pdev, ret = pci_read_config_dword(chip->pdev,
O2_SD_FUNC_REG0, O2_SD_FUNC_REG0,
&scratch_32); &scratch_32);
if (ret)
return ret;
scratch_32 = ((scratch_32 & 0xFF000000) >> 24); scratch_32 = ((scratch_32 & 0xFF000000) >> 24);
/* Check Whether subId is 0x11 or 0x12 */ /* Check Whether subId is 0x11 or 0x12 */
...@@ -716,6 +718,8 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip) ...@@ -716,6 +718,8 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
ret = pci_read_config_dword(chip->pdev, ret = pci_read_config_dword(chip->pdev,
O2_SD_FUNC_REG4, O2_SD_FUNC_REG4,
&scratch_32); &scratch_32);
if (ret)
return ret;
/* Enable Base Clk setting change */ /* Enable Base Clk setting change */
scratch_32 |= O2_SD_FREG4_ENABLE_CLK_SET; scratch_32 |= O2_SD_FREG4_ENABLE_CLK_SET;
...@@ -795,6 +799,8 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip) ...@@ -795,6 +799,8 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
ret = pci_read_config_dword(chip->pdev, ret = pci_read_config_dword(chip->pdev,
O2_SD_PLL_SETTING, &scratch_32); O2_SD_PLL_SETTING, &scratch_32);
if (ret)
return ret;
if ((scratch_32 & 0xff000000) == 0x01000000) { if ((scratch_32 & 0xff000000) == 0x01000000) {
scratch_32 &= 0x0000FFFF; scratch_32 &= 0x0000FFFF;
...@@ -812,6 +818,8 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip) ...@@ -812,6 +818,8 @@ static int sdhci_pci_o2_probe(struct sdhci_pci_chip *chip)
ret = pci_read_config_dword(chip->pdev, ret = pci_read_config_dword(chip->pdev,
O2_SD_FUNC_REG4, O2_SD_FUNC_REG4,
&scratch_32); &scratch_32);
if (ret)
return ret;
scratch_32 |= (1 << 22); scratch_32 |= (1 << 22);
pci_write_config_dword(chip->pdev, pci_write_config_dword(chip->pdev,
O2_SD_FUNC_REG4, scratch_32); O2_SD_FUNC_REG4, scratch_32);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment