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

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: 7582041ff3d4 ("mmc: sdhci-pci: fix simple_return.cocci warnings")
Fixes: 45211e215984 ("sdhci: toggle JMicron PMOS setting")
Cc: stable@vger.kernel.org
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240527132443.14038-1-ilpo.jarvinen@linux.intel.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Ilpo Järvinen and committed by
Ulf Hansson
ebc4fc34 6ba59ff4

+7 -4
+7 -4
drivers/mmc/host/sdhci-pci-core.c
··· 1326 1326 1327 1327 ret = pci_read_config_byte(chip->pdev, 0xAE, &scratch); 1328 1328 if (ret) 1329 - return ret; 1329 + goto fail; 1330 1330 1331 1331 /* 1332 1332 * Turn PMOS on [bit 0], set over current detection to 2.4 V ··· 1337 1337 else 1338 1338 scratch &= ~0x47; 1339 1339 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); 1341 1344 } 1342 1345 1343 1346 static int jmicron_probe(struct sdhci_pci_chip *chip) ··· 2205 2202 2206 2203 ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &slots); 2207 2204 if (ret) 2208 - return ret; 2205 + return pcibios_err_to_errno(ret); 2209 2206 2210 2207 slots = PCI_SLOT_INFO_SLOTS(slots) + 1; 2211 2208 dev_dbg(&pdev->dev, "found %d slot(s)\n", slots); ··· 2214 2211 2215 2212 ret = pci_read_config_byte(pdev, PCI_SLOT_INFO, &first_bar); 2216 2213 if (ret) 2217 - return ret; 2214 + return pcibios_err_to_errno(ret); 2218 2215 2219 2216 first_bar &= PCI_SLOT_INFO_FIRST_BAR_MASK; 2220 2217