Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

platform/chrome: cros_ec_typec: Defer probe on missing EC parent

If cros_typec_probe is called before EC device is registered,
cros_typec_probe will fail. It may happen when cros-ec-typec.ko is
loaded before EC bus layer module (e.g. cros_ec_lpcs.ko,
cros_ec_spi.ko).

Return -EPROBE_DEFER when cros_typec_probe doesn't get EC device, so
the probe function can be called again after EC device is registered.

Signed-off-by: Tomasz Michalec <tmichalec@google.com>
Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Link: https://lore.kernel.org/r/20250610153748.1858519-1-tmichalec@google.com
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>

authored by

Tomasz Michalec and committed by
Tzung-Bi Shih
8866f4e5 19272b37

+2 -2
+2 -2
drivers/platform/chrome/cros_ec_typec.c
··· 1272 1272 1273 1273 typec->ec = dev_get_drvdata(pdev->dev.parent); 1274 1274 if (!typec->ec) { 1275 - dev_err(dev, "couldn't find parent EC device\n"); 1276 - return -ENODEV; 1275 + dev_warn(dev, "couldn't find parent EC device\n"); 1276 + return -EPROBE_DEFER; 1277 1277 } 1278 1278 1279 1279 platform_set_drvdata(pdev, typec);