]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
platform/chrome: cros_ec_typec: Defer probe on missing EC parent
authorTomasz Michalec <tmichalec@google.com>
Tue, 10 Jun 2025 15:37:47 +0000 (17:37 +0200)
committerTzung-Bi Shih <tzungbi@kernel.org>
Wed, 11 Jun 2025 02:12:53 +0000 (02:12 +0000)
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>
drivers/platform/chrome/cros_ec_typec.c

index 7678e3d05fd36fb0548640063a6a4d73ae35594f..f437b594055cff700da7ced0cc3260a29dda437b 100644 (file)
@@ -1272,8 +1272,8 @@ static int cros_typec_probe(struct platform_device *pdev)
 
        typec->ec = dev_get_drvdata(pdev->dev.parent);
        if (!typec->ec) {
-               dev_err(dev, "couldn't find parent EC device\n");
-               return -ENODEV;
+               dev_warn(dev, "couldn't find parent EC device\n");
+               return -EPROBE_DEFER;
        }
 
        platform_set_drvdata(pdev, typec);