Skip to content

Commit 6cfa038

Browse files
jhovoldkrzk
authored andcommitted
memory: mtk-smi: fix device leaks on common probe
Make sure to drop the reference taken when looking up the SMI device during common probe on late probe failure (e.g. probe deferral) and on driver unbind. Fixes: 4740475 ("memory: mtk-smi: Add device link for smi-sub-common") Fixes: 038ae37 ("memory: mtk-smi: add missing put_device() call in mtk_smi_device_link_common") Cc: stable@vger.kernel.org # 5.16: 038ae37 Cc: stable@vger.kernel.org # 5.16 Cc: Yong Wu <yong.wu@mediatek.com> Cc: Miaoqian Lin <linmq006@gmail.com> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20251121164624.13685-2-johan@kernel.org Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
1 parent 8f0b4cc commit 6cfa038

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/memory/mtk-smi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,7 @@ static int mtk_smi_larb_probe(struct platform_device *pdev)
674674
err_pm_disable:
675675
pm_runtime_disable(dev);
676676
device_link_remove(dev, larb->smi_common_dev);
677+
put_device(larb->smi_common_dev);
677678
return ret;
678679
}
679680

@@ -917,6 +918,7 @@ static void mtk_smi_common_remove(struct platform_device *pdev)
917918
if (common->plat->type == MTK_SMI_GEN2_SUB_COMM)
918919
device_link_remove(&pdev->dev, common->smi_common_dev);
919920
pm_runtime_disable(&pdev->dev);
921+
put_device(common->smi_common_dev);
920922
}
921923

922924
static int __maybe_unused mtk_smi_common_resume(struct device *dev)

0 commit comments

Comments
 (0)