Skip to content

Commit ebc4fc3

Browse files
ij-intelstorulf
authored andcommitted
mmc: sdhci-pci: Convert PCIBIOS_* return codes to errnos
jmicron_pmos() and sdhci_pci_probe() use pci_{read,write}_config_byte() that return PCIBIOS_* codes. The return code is then returned as is by jmicron_probe() and sdhci_pci_probe(). Similarly, the return code is also returned as is from jmicron_resume(). Both probe and resume functions should return normal errnos. Convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal errno before returning them the fix these issues. Fixes: 7582041 ("mmc: sdhci-pci: fix simple_return.cocci warnings") Fixes: 45211e2 ("sdhci: toggle JMicron PMOS setting") Cc: [email protected] Signed-off-by: Ilpo Järvinen <[email protected]> Acked-by: Adrian Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 6ba59ff commit ebc4fc3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/mmc/host/sdhci-pci-core.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,7 @@ static int jmicron_pmos(struct sdhci_pci_chip *chip, int on)
13261326

13271327
ret = pci_read_config_byte(chip->pdev, 0xAE, &scratch);
13281328
if (ret)
1329-
return ret;
1329+
goto fail;
13301330

13311331
/*
13321332
* Turn PMOS on [bit 0], set over current detection to 2.4 V
@@ -1337,7 +1337,10 @@ static int jmicron_pmos(struct sdhci_pci_chip *chip, int on)
13371337
else
13381338
scratch &= ~0x47;
13391339

1340-
return pci_write_config_byte(chip->pdev, 0xAE, scratch);
1340+
ret = pci_write_config_byte(chip->pdev, 0xAE, scratch);
1341+
1342+
fail:
1343+
return pcibios_err_to_errno(ret);
13411344
}
13421345

13431346
static int jmicron_probe(struct sdhci_pci_chip *chip)
@@ -2202,7 +2205,7 @@ static int sdhci_pci_probe(struct pci_dev *pdev,
22022205

22032206
ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &slots);
22042207
if (ret)
2205-
return ret;
2208+
return pcibios_err_to_errno(ret);
22062209

22072210
slots = PCI_SLOT_INFO_SLOTS(slots) + 1;
22082211
dev_dbg(&pdev->dev, "found %d slot(s)\n", slots);
@@ -2211,7 +2214,7 @@ static int sdhci_pci_probe(struct pci_dev *pdev,
22112214

22122215
ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &first_bar);
22132216
if (ret)
2214-
return ret;
2217+
return pcibios_err_to_errno(ret);
22152218

22162219
first_bar &= PCI_SLOT_INFO_FIRST_BAR_MASK;
22172220

0 commit comments

Comments
 (0)