The of_find_device_by_node takes a reference to the struct device when find the match device,we should release it when fail. Fix it by calling by calling platform_device_put when error returns. Signed-off-by: Zhang Shurong <zhang_shurong@xxxxxxxxxxx> --- drivers/usb/dwc3/dwc3-imx8mp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c index a1e15f2fffdb..af5302c3f7a9 100644 --- a/drivers/usb/dwc3/dwc3-imx8mp.c +++ b/drivers/usb/dwc3/dwc3-imx8mp.c @@ -244,7 +244,7 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) IRQF_ONESHOT, dev_name(dev), dwc3_imx); if (err) { dev_err(dev, "failed to request IRQ #%d --> %d\n", irq, err); - goto depopulate; + goto err_device_put; } device_set_wakeup_capable(dev, true); @@ -252,6 +252,8 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev) return 0; +err_device_put: + platform_device_put(dwc3_imx->dwc3); depopulate: of_platform_depopulate(dev); err_node_put: -- 2.30.2