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.

Reviewed-by: Peng Fan <[email protected]>
Reviewed-by: Mathieu Poirier <[email protected]>
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 516a05b64daa1..a8d4e970fb786 100644
--- a/drivers/mailbox/imx-mailbox.c
+++ b/drivers/mailbox/imx-mailbox.c
@@ -984,7 +984,7 @@ static int imx_mu_probe(struct platform_device *pdev)
        if (ret)
                goto err_out;
 
-       of_platform_populate(dev->of_node, NULL, NULL, dev);
+       devm_of_platform_populate(dev);
 
        return 0;
 

-- 
2.53.0


Reply via email to