mfd: cros_ec: Use devm_of_platform_populate()
authorBenjamin Gaignard <benjamin.gaignard@linaro.org>
Mon, 29 May 2017 15:45:55 +0000 (17:45 +0200)
committerLee Jones <lee.jones@linaro.org>
Thu, 6 Jul 2017 07:29:12 +0000 (08:29 +0100)
Use devm_of_platform_populate() to be sure that of_platform_depopulate
is called when removing the driver.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/cros_ec.c

index d4a407e466b5478465823c02cd8cfdd95f1b1748..e31ac60a76231d1b6cf0582ce143f0e49a56131c 100644 (file)
@@ -147,7 +147,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
        }
 
        if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
-               err = of_platform_populate(dev->of_node, NULL, NULL, dev);
+               err = devm_of_platform_populate(dev);
                if (err) {
                        mfd_remove_devices(dev);
                        dev_err(dev, "Failed to register sub-devices\n");