summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-05-13 09:56:35 +0200
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-05-20 17:27:08 +0300
commit560331eaee6c552adc1b8201063ccbfe5009bc12 (patch)
tree4ddaded216d39525fa99248e58ea6f8f78926be8
parentec9964b4803300fb86f8e8fd9b421e59f7a71dc5 (diff)
downloadlinux-stable-560331eaee6c552adc1b8201063ccbfe5009bc12.tar.gz
linux-stable-560331eaee6c552adc1b8201063ccbfe5009bc12.tar.bz2
linux-stable-560331eaee6c552adc1b8201063ccbfe5009bc12.zip
Platform: OLPC: Avoid a warning if the EC didn't register yet
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>
-rw-r--r--drivers/platform/olpc/olpc-ec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/platform/olpc/olpc-ec.c b/drivers/platform/olpc/olpc-ec.c
index 2a647455a368..a91f78245f5e 100644
--- a/drivers/platform/olpc/olpc-ec.c
+++ b/drivers/platform/olpc/olpc-ec.c
@@ -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)