The driver uses of_platform_populate() but does not remove the added
devices on removal. This can lead to "double devices" on module removal
followed by adding the module again.

Use devm_of_platform_populate() to remove the populated devices once the
parent device is removed.

Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
---
 drivers/mailbox/imx-mailbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c
index 24cf704b4f9bd..1dda1437b87f6 100644
--- a/drivers/mailbox/imx-mailbox.c
+++ b/drivers/mailbox/imx-mailbox.c
@@ -983,7 +983,7 @@ static int imx_mu_probe(struct platform_device *pdev)
        if (ret)
                goto disable_clk;
 
-       of_platform_populate(dev->of_node, NULL, NULL, dev);
+       devm_of_platform_populate(dev);
 
        return 0;
 

-- 
2.53.0


Reply via email to