summaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki@gmail.com>2022-04-04 06:11:01 +0200
committerPrashant Malani <pmalani@chromium.org>2022-05-11 00:47:40 +0200
commit7464ff8bf2d762251b9537863db0e1caf9b0e402 (patch)
treeaac63c231dfaeee1ae0f2a860bcdead04974ba27 /drivers/platform
parentplatform/chrome: cros_ec_lpcs: reserve the MEC LPC I/O ports first (diff)
downloadlinux-7464ff8bf2d762251b9537863db0e1caf9b0e402.tar.xz
linux-7464ff8bf2d762251b9537863db0e1caf9b0e402.zip
platform/chrome: cros_ec_typec: Check for EC driver
The EC driver may not be initialized when cros_typec_probe is called, particulary when CONFIG_CROS_EC_CHARDEV=m. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Reviewed-by: Guenter Roeck <groeck@chromium.org> Link: https://lore.kernel.org/r/20220404041101.6276-1-akihiko.odaki@gmail.com Signed-off-by: Prashant Malani <pmalani@chromium.org>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/chrome/cros_ec_typec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index 4bd2752c0823..7cb2e35c4ded 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -1084,6 +1084,9 @@ static int cros_typec_probe(struct platform_device *pdev)
}
ec_dev = dev_get_drvdata(&typec->ec->ec->dev);
+ if (!ec_dev)
+ return -EPROBE_DEFER;
+
typec->typec_cmd_supported = cros_ec_check_features(ec_dev, EC_FEATURE_TYPEC_CMD);
typec->needs_mux_ack = cros_ec_check_features(ec_dev, EC_FEATURE_TYPEC_MUX_REQUIRE_AP_ACK);