Platform: OLPC: Avoid a warning if the EC didn't register yet
authorLubomir Rintel <lkundrak@v3.sk>
Mon, 13 May 2019 07:56:35 +0000 (09:56 +0200)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 20 May 2019 14:27:08 +0000 (17:27 +0300)
Just return EPROBE_DEFER, so that whoever attempted to use the EC call can
defer their work.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/platform/olpc/olpc-ec.c

index 2a647455a368328e284645a76b2097469c6be8a3..a91f78245f5e2cfbb8f4db73cd72236558a1ff52 100644 (file)
@@ -125,8 +125,11 @@ int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf, size_t outlen)
        struct olpc_ec_priv *ec = ec_priv;
        struct ec_cmd_desc desc;
 
-       /* Ensure a driver and ec hook have been registered */
-       if (WARN_ON(!ec_driver || !ec_driver->ec_cmd))
+       /* Driver not yet registered. */
+       if (!ec_driver)
+               return -EPROBE_DEFER;
+
+       if (WARN_ON(!ec_driver->ec_cmd))
                return -ENODEV;
 
        if (!ec)