mfd: intel-lpss: Return error code received from the IRQ API
authorChen Ni <nichen@iscas.ac.cn>
Mon, 6 Nov 2023 18:40:52 +0000 (20:40 +0200)
committerLee Jones <lee@kernel.org>
Thu, 7 Dec 2023 13:50:25 +0000 (13:50 +0000)
platform_get_irq() returns a negative error code to indicate an error.
As does pci_alloc_irq_vectors() and pci_irq_vector(). So in
intel_lpss_probe() the erroneous IRQ would be better returned as is.

The pci_alloc_irq_vectors() call and platform_get_irq() guarantee
that IRQs will not be 0, so we'll drop that check as well.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
[andy: updated commit message]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20231106184052.1166579-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/mfd/intel-lpss.c

index 9115ba4..bbd65da 100644 (file)
@@ -378,9 +378,12 @@ int intel_lpss_probe(struct device *dev,
        struct intel_lpss *lpss;
        int ret;
 
-       if (!info || !info->mem || info->irq <= 0)
+       if (!info || !info->mem)
                return -EINVAL;
 
+       if (info->irq < 0)
+               return info->irq;
+
        lpss = devm_kzalloc(dev, sizeof(*lpss), GFP_KERNEL);
        if (!lpss)
                return -ENOMEM;