Skip to content

Commit 038ae37

Browse files
Yuuoniykrzk
authored andcommitted
memory: mtk-smi: add missing put_device() call in mtk_smi_device_link_common
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: 4740475 ("memory: mtk-smi: Add device link for smi-sub-common") Signed-off-by: Miaoqian Lin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Krzysztof Kozlowski <[email protected]>
1 parent 67c7fc6 commit 038ae37

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/memory/mtk-smi.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,13 +404,16 @@ static int mtk_smi_device_link_common(struct device *dev, struct device **com_de
404404
of_node_put(smi_com_node);
405405
if (smi_com_pdev) {
406406
/* smi common is the supplier, Make sure it is ready before */
407-
if (!platform_get_drvdata(smi_com_pdev))
407+
if (!platform_get_drvdata(smi_com_pdev)) {
408+
put_device(&smi_com_pdev->dev);
408409
return -EPROBE_DEFER;
410+
}
409411
smi_com_dev = &smi_com_pdev->dev;
410412
link = device_link_add(dev, smi_com_dev,
411413
DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
412414
if (!link) {
413415
dev_err(dev, "Unable to link smi-common dev\n");
416+
put_device(&smi_com_pdev->dev);
414417
return -ENODEV;
415418
}
416419
*com_dev = smi_com_dev;

0 commit comments

Comments
 (0)