Skip to contentSkip to conversation

driver core: platform: Make use of the helper function dev_err_probe()

PATCH New Cai Huoqing 1 participant 1 message Nov 5, 2021 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 driver core: platform: Make use of the helper function dev_err_probe()

When possible using dev_err_probe() helps to properly deal with the PROBE_DEFER error, the benefit is that DEFER issue will be logged in the devices_deferred debugfs file.

---
v1->v2: *Revert the change of variable name 'dev'.

 drivers/base/platform.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/base/platform.c +3 -2
index 598acf93a360..7109351366c8 100644
@@ -258,8 +258,9 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
 	int ret;
 
 	ret = platform_get_irq_optional(dev, num);
-	if (ret < 0 && ret != -EPROBE_DEFER)
-		dev_err(&dev->dev, "IRQ index %u not found\n", num);
+	if (ret < 0)
+		return dev_err_probe(&dev->dev, ret,
+				     "IRQ index %u not found\n", num);
 
 	return ret;
 }
Signature · 1 line
2.25.1