From 70af08d8634c00e9593a4407b86a303246791cfb Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 20 Oct 2016 09:27:41 +0200 Subject: state: driver: handle EPROBE_DEFER 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 --- 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 b9eb1b7bb2..b43aee60fe 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; } -- cgit v1.2.3