leds: ss4200: Convert PCIBIOS_* return codes to errnos

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>

commit ce068e83976140badb19c7f1307926b4b562fac4 upstream.

ich7_lpc_probe() uses pci_read_config_dword() that returns PCIBIOS_*
codes. The error handling code assumes incorrectly it's a normal errno
and checks for < 0. The return code is returned from the probe function
as is but probe functions should return normal errnos.

Remove < 0 from the check and convert PCIBIOS_* returns code using
pcibios_err_to_errno() into normal errno before returning it.

Fixes: a328e95b82c1 ("leds: LED driver for Intel NAS SS4200 series (v5)")
Cc:  <stable@xxxxxxxxxxxxxxx>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
Link: https://lore.kernel.org/r/20240527132700.14260-1-ilpo.jarvinen@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/leds/leds-ss4200.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/drivers/leds/leds-ss4200.c
+++ b/drivers/leds/leds-ss4200.c
@@ -356,8 +356,10 @@ static int ich7_lpc_probe(struct pci_dev
 
 	nas_gpio_pci_dev = dev;
 	status = pci_read_config_dword(dev, PMBASE, &g_pm_io_base);
-	if (status)
+	if (status) {
+		status = pcibios_err_to_errno(status);
 		goto out;
+	}
 	g_pm_io_base &= 0x00000ff80;
 
 	status = pci_read_config_dword(dev, GPIO_CTRL, &gc);
@@ -369,8 +371,9 @@ static int ich7_lpc_probe(struct pci_dev
 	}
 
 	status = pci_read_config_dword(dev, GPIO_BASE, &nas_gpio_io_base);
-	if (0 > status) {
+	if (status) {
 		dev_info(&dev->dev, "Unable to read GPIOBASE.\n");
+		status = pcibios_err_to_errno(status);
 		goto out;
 	}
 	dev_dbg(&dev->dev, ": GPIOBASE = 0x%08x\n", nas_gpio_io_base);


Patches currently in stable-queue which might be from ilpo.jarvinen@xxxxxxxxxxxxxxx are

queue-6.10/pci-fix-resource-double-counting-on-remove-rescan.patch
queue-6.10/pci-endpoint-clean-up-error-handling-in-vpci_scan_bu.patch
queue-6.10/x86-of-return-consistent-error-type-from-x86_of_pci_.patch
queue-6.10/selftests-resctrl-fix-closing-imc-fds-on-error-and-o.patch
queue-6.10/x86-platform-iosf_mbi-convert-pcibios_-return-codes-.patch
queue-6.10/leds-ss4200-convert-pcibios_-return-codes-to-errnos.patch
queue-6.10/platform-arm64-build-drivers-even-on-non-arm64-platf.patch
queue-6.10/platform-x86-asus-wmi-fix-tuf-laptop-rgb-variant.patch
queue-6.10/x86-pci-intel_mid_pci-fix-pcibios_-return-code-handl.patch
queue-6.10/firmware-turris-mox-rwtm-fix-checking-return-value-o.patch
queue-6.10/x86-pci-xen-fix-pcibios_-return-code-handling.patch
queue-6.10/pci-endpoint-fix-error-handling-in-epf_ntb_epc_clean.patch




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux