mfd: cros_ec: Check DT node for usbpd-notify add
authorPrashant Malani <pmalani@chromium.org>
Mon, 10 Feb 2020 19:06:24 +0000 (11:06 -0800)
committerLee Jones <lee.jones@linaro.org>
Mon, 30 Mar 2020 06:34:56 +0000 (07:34 +0100)
Add a check to ensure there is indeed an EC device tree entry before
adding the cros-usbpd-notify device. This covers configs where both
CONFIG_ACPI and CONFIG_OF are defined, but the EC device is defined
using device tree and not in ACPI.

Fixes: 4602dce0361e ("mfd: cros_ec: Add cros-usbpd-notify subdevice")
Signed-off-by: Prashant Malani <pmalani@chromium.org>
Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/cros_ec_dev.c

index 39e611695053629114e346d27090e936aa539ea8..32c2b912b58b257dff03085e2bbfc6b22d1b5ae3 100644 (file)
@@ -211,7 +211,7 @@ static int ec_device_probe(struct platform_device *pdev)
         * explicitly added on platforms that don't have the PD notifier ACPI
         * device entry defined.
         */
-       if (IS_ENABLED(CONFIG_OF)) {
+       if (IS_ENABLED(CONFIG_OF) && ec->ec_dev->dev->of_node) {
                if (cros_ec_check_features(ec, EC_FEATURE_USB_PD)) {
                        retval = mfd_add_hotplug_devices(ec->dev,
                                        cros_usbpd_notify_cells,