[PATCH 2/3] state: driver: handle EPROBE_DEFER

Sascha Hauer s.hauer at pengutronix.de
Thu Oct 20 00:31:21 PDT 2016


When state_new_from_node() returns -ENODEV that means that there
is no device available for the node, so return -EPROBE_DEFER in this
case and hope a device is there later.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/misc/state.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/state.c b/drivers/misc/state.c
index b9eb1b7..b43aee6 100644
--- a/drivers/misc/state.c
+++ b/drivers/misc/state.c
@@ -28,8 +28,12 @@ static int state_probe(struct device_d *dev)
 	bool readonly = false;
 
 	state = state_new_from_node(np, NULL, 0, 0, readonly);
-	if (IS_ERR(state))
-		return PTR_ERR(state);
+	if (IS_ERR(state)) {
+		int ret = PTR_ERR(state);
+		if (ret == -ENODEV)
+			ret = -EPROBE_DEFER;
+		return ret;
+	}
 
 	return 0;
 }
-- 
2.9.3




More information about the barebox mailing list