This is a note to let you know that I've just added the patch titled memory: mtk-smi: add missing put_device() call in mtk_smi_device_link_common to the 5.18-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: memory-mtk-smi-add-missing-put_device-call-in-mtk_smi_device_link_common.patch and it can be found in the queue-5.18 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 038ae37c510fd57cbc543ac82db1e7b23b28557a Mon Sep 17 00:00:00 2001 From: Miaoqian Lin <linmq006@xxxxxxxxx> Date: Wed, 1 Jun 2022 16:01:18 +0400 Subject: memory: mtk-smi: add missing put_device() call in mtk_smi_device_link_common From: Miaoqian Lin <linmq006@xxxxxxxxx> commit 038ae37c510fd57cbc543ac82db1e7b23b28557a upstream. The reference taken by 'of_find_device_by_node()' must be released when not needed anymore. Add the corresponding 'put_device()' in the error handling paths. Fixes: 47404757702e ("memory: mtk-smi: Add device link for smi-sub-common") Signed-off-by: Miaoqian Lin <linmq006@xxxxxxxxx> Link: https://lore.kernel.org/r/20220601120118.60225-1-linmq006@xxxxxxxxx Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/memory/mtk-smi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 86a3d34f418e..4c5154e0bf00 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -404,13 +404,16 @@ static int mtk_smi_device_link_common(struct device *dev, struct device **com_de of_node_put(smi_com_node); if (smi_com_pdev) { /* smi common is the supplier, Make sure it is ready before */ - if (!platform_get_drvdata(smi_com_pdev)) + if (!platform_get_drvdata(smi_com_pdev)) { + put_device(&smi_com_pdev->dev); return -EPROBE_DEFER; + } smi_com_dev = &smi_com_pdev->dev; link = device_link_add(dev, smi_com_dev, DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS); if (!link) { dev_err(dev, "Unable to link smi-common dev\n"); + put_device(&smi_com_pdev->dev); return -ENODEV; } *com_dev = smi_com_dev; -- 2.36.1 Patches currently in stable-queue which might be from linmq006@xxxxxxxxx are queue-5.18/memory-mtk-smi-add-missing-put_device-call-in-mtk_smi_device_link_common.patch queue-5.18/iio-adc-adi-axi-adc-fix-refcount-leak-in-adi_axi_adc_attach_client.patch queue-5.18/memory-samsung-exynos5422-dmc-fix-refcount-leak-in-of_get_dram_timings.patch queue-5.18/arm-fix-refcount-leak-in-axxia_boot_secondary.patch queue-5.18/drm-msm-mdp4-fix-refcount-leak-in-mdp4_modeset_init_.patch queue-5.18/arm-cns3xxx-fix-refcount-leak-in-cns3xxx_init.patch queue-5.18/iio-adc-aspeed-fix-refcount-leak-in-aspeed_adc_set_trim_data.patch queue-5.18/soc-bcm-brcmstb-pm-pm-arm-fix-refcount-leak-in-brcmstb_pm_probe.patch queue-5.18/arm-exynos-fix-refcount-leak-in-exynos_map_pmu.patch