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>
This commit is contained in:
Lubomir Rintel 2019-05-13 09:56:35 +02:00 committed by Andy Shevchenko
parent ec9964b480
commit 560331eaee

View 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)