Skip to contentSkip to conversation

intel_th: pci: Convert PCIBIOS_* return codes to errnos

PATCH New Ilpo Järvinen 1 participant 1 message May 27, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 intel_th: pci: Convert PCIBIOS_* return codes to errnos

intel_th_pci_activate() uses pci_{read,write}_config_dword() that return PCIBIOS_* codes. The value is returned as is to the caller. The non-errno return value is returned all the way to active_store() which then returns the value like it is an error. PCIBIOS_* return codes, however, are positive (0x8X) so the return value of the store function is treated as the length consumed from the write buffer which can confuse the userspace writer.

Convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal errno before returning it from intel_th_pci_activate().

Fixes a0e7df335afd ("intel_th: Perform time resync on capture start")
---
 drivers/hwtracing/intel_th/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/intel_th/pci.c +1 -1
index 147d338c191e..40e2c922fbe7 100644
@@ -46,7 +46,7 @@ static int intel_th_pci_activate(struct intel_th *th)
 	if (err)
 		dev_err(&pdev->dev, "failed to read NPKDSC register\n");
 
-	return err;
+	return pcibios_err_to_errno(err);
 }
 
 static void intel_th_pci_deactivate(struct intel_th *th)
Signature · 1 line
2.39.2