[PATCH v3 1/2] acpi: Fix proper return code for function acpi_gsi_to_irq

Borislav Petkov bp at alien8.de
Tue Jan 12 10:32:28 PST 2016


On Tue, Jan 12, 2016 at 10:26:04AM -0800, Tuan Phan wrote:
> So are you good with it?

How about this instead:

---
diff --git a/drivers/acpi/gsi.c b/drivers/acpi/gsi.c
index fa4585a6914e..e42f6b7eac13 100644
--- a/drivers/acpi/gsi.c
+++ b/drivers/acpi/gsi.c
@@ -46,17 +46,22 @@ static unsigned int acpi_gsi_get_irq_type(int trigger, int polarity)
  * Returns: linux IRQ number on success (>0)
  *          -EINVAL on failure
  */
-int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
+int acpi_gsi_to_irq(u32 gsi)
 {
+	unsigned int irq;
+
 	struct irq_domain *d = irq_find_matching_fwnode(acpi_gsi_domain_id,
 							DOMAIN_BUS_ANY);
 
-	*irq = irq_find_mapping(d, gsi);
+	irq = irq_find_mapping(d, gsi);
 	/*
 	 * *irq == 0 means no mapping, that should
 	 * be reported as a failure
 	 */
-	return (*irq > 0) ? *irq : -EINVAL;
+	if (irq > 0)
+		return irq;
+	else
+		return -EINVAL;
 }
 EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
 

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.



More information about the linux-arm-kernel mailing list