Skip to content

Commit

Permalink
Platform: OLPC: Avoid a warning if the EC didn't register yet
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lubomir Rintel authored and Andy Shevchenko committed May 20, 2019
1 parent ec9964b commit 560331e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/platform/olpc/olpc-ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 560331e

Please sign in to comment.