Skip to contentSkip to conversation

driver:core: no need to invert the return value of the call_driver_probe()

PATCH Superseded Lizhe 2 participants 3 messages Jul 9, 2024 – Jul 10, 2024 Driver core

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Lizhe

author
#0 lore raw

PATCH v3 1/1 driver:core: no need to invert the return value of the call_driver_probe()

In the probe function (either drv->bus->probe() or drv->probe()), there is no return value of EPROBE_DEFER. the error return from probe should be -EPROBE_DEFER, hence no negation of call_driver_probe()'s return is needed, nor should there be an EPROBE_DEFER check in driver_probe_device()

v3:
Modify commit message and versions go below the ---
v2:
Delete the judgment with the return value of EPROBEDEFER from the _driver_probe.device()
v1:
Add the judgment with the return value of EPROBEDEFER from the _driver_probe.device()

---
 drivers/base/dd.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/base/dd.c +1 -6
index 83d352394fdf..d047919d1f5e 100644
@@ -664,11 +664,6 @@ static int really_probe(struct device *dev, struct device_driver *drv)
 		if (link_ret == -EAGAIN)
 			ret = -EPROBE_DEFER;
 
-		/*
-		 * Return probe errors as positive values so that the callers
-		 * can distinguish them from other errors.
-		 */
-		ret = -ret;
 		goto probe_failed;
 	}
 
@@ -826,7 +821,7 @@ static int driver_probe_device(struct device_driver *drv, struct device *dev)
 
 	atomic_inc(&probe_count);
 	ret = __driver_probe_device(drv, dev);
-	if (ret == -EPROBE_DEFER || ret == EPROBE_DEFER) {
+	if (ret == -EPROBE_DEFER) {
 		driver_deferred_probe_add(dev);
 
 		/*
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 16 lines · Lizhe

In the probe function (either drv->bus->probe() or drv->probe()), there is no return value of EPROBE_DEFER. the error return from probe should be -EPROBE_DEFER, hence no negation of call_driver_probe()'s return is needed, nor should there be an EPROBE_DEFER check in driver_probe_device()

v3:
Modify commit message and versions go below the ---
v2:
Delete the judgment with the return value of EPROBEDEFER from the _driver_probe.device()
v1:
Add the judgment with the return value of EPROBEDEFER from the _driver_probe.device()

Quoted 3 lines
---
 drivers/base/dd.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

The documentation says to put the vN: stuff below the --- line, right?

And how did you find this issue?

thanks,

greg kh-

maintainer
#2 lore raw
In reply to Lizhe
Quoted 10 lines · Lizhe

In the probe function (either drv->bus->probe() or drv->probe()), there is no return value of EPROBE_DEFER. the error return from probe should be -EPROBE_DEFER, hence no negation of call_driver_probe()'s return is needed, nor should there be an EPROBE_DEFER check in driver_probe_device()

v3:
Modify commit message and versions go below the ---

That didn't happen here :(