[PATCH v1 2/2] spi: Deduplicate deferred probe checks in spi_probe()

From: Andy Shevchenko
Date: Sun Dec 08 2024 - 14:56:51 EST


Deduplicate deferred probe checks in spi_probe() and enable
the error message for ACPI case as well.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
drivers/spi/spi.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 88f785b9e6ec..e0f79773be70 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -417,19 +417,14 @@ static int spi_probe(struct device *dev)
if (ret)
return ret;

- if (is_of_node(fwnode)) {
+ if (is_of_node(fwnode))
spi->irq = of_irq_get(dev->of_node, 0);
- if (spi->irq == -EPROBE_DEFER)
- return dev_err_probe(dev, -EPROBE_DEFER, "Failed to get irq\n");
- if (spi->irq < 0)
- spi->irq = 0;
- } else if (is_acpi_device_node(fwnode) && spi->irq < 0) {
+ else if (is_acpi_device_node(fwnode) && spi->irq < 0)
spi->irq = acpi_dev_gpio_irq_get(to_acpi_device_node(fwnode), 0);
- if (spi->irq == -EPROBE_DEFER)
- return -EPROBE_DEFER;
- if (spi->irq < 0)
- spi->irq = 0;
- }
+ if (spi->irq == -EPROBE_DEFER)
+ return dev_err_probe(dev, spi->irq, "Failed to get irq\n");
+ if (spi->irq < 0)
+ spi->irq = 0;

ret = dev_pm_domain_attach(dev, true);
if (ret)
--
2.43.0.rc1.1336.g36b5255a03ac