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 <[email protected]>
---
 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


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to