drivers/gpu/drm/mediatek/mtk_hdmi_common.c:277:2-8: ERROR: missing put_device; call of_find_device_by_node on line 266, but without a corresponding object release within this function.

kernel test robot <[email protected]> Wed, 29 Jul 2026 13:14:17 +0800
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
BCC: [email protected]
CC: [email protected]
CC: [email protected]
TO: AngeloGioacchino Del Regno <[email protected]>
CC: "Chun-Kuang Hu" <[email protected]>
CC: CK Hu <[email protected]>
CC: "Louis-Alexis Eyraud" <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   fc02acf6ac0ccde0c805c2daa9148683cdd01ba8
commit: 86b1e68fe0869bdcb38ed5283a25931a5581ffcc drm/mediatek: mtk_hdmi: Split driver and add common probe function
date:   8 months ago
:::::: branch date: 8 hours ago
:::::: commit date: 8 months ago
config: nios2-randconfig-r053-20260729 (https://download.01.org/0day-ci/archive/20260729/[email protected]/config)
compiler: nios2-linux-gcc (GCC) 8.5.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: 86b1e68fe086 ("drm/mediatek: mtk_hdmi: Split driver and add common probe function")
| Reported-by: kernel test robot <[email protected]>
| Reported-by: Julia Lawall <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

cocci warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/mediatek/mtk_hdmi_common.c:277:2-8: ERROR: missing put_device; call of_find_device_by_node on line 266, but without a corresponding object release within this function.
   drivers/gpu/drm/mediatek/mtk_hdmi_common.c:287:2-8: ERROR: missing put_device; call of_find_device_by_node on line 266, but without a corresponding object release within this function.

vim +277 drivers/gpu/drm/mediatek/mtk_hdmi_common.c

86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  254  
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  255  static int mtk_hdmi_get_cec_dev(struct mtk_hdmi *hdmi, struct device *dev, struct device_node *np)
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  256  {
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  257  	struct platform_device *cec_pdev;
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  258  	struct device_node *cec_np;
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  259  	int ret;
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  260  
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  261  	/* The CEC module handles HDMI hotplug detection */
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  262  	cec_np = of_get_compatible_child(np->parent, "mediatek,mt8173-cec");
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  263  	if (!cec_np)
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  264  		return dev_err_probe(dev, -EINVAL, "Failed to find CEC node\n");
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  265  
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23 @266  	cec_pdev = of_find_device_by_node(cec_np);
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  267  	if (!cec_pdev) {
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  268  		dev_err(hdmi->dev, "Waiting for CEC device %pOF\n",
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  269  			cec_np);
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  270  		of_node_put(cec_np);
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  271  		return -EPROBE_DEFER;
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  272  	}
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  273  	of_node_put(cec_np);
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  274  
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  275  	ret = devm_add_action_or_reset(dev, mtk_hdmi_put_device, &cec_pdev->dev);
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  276  	if (ret)
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23 @277  		return ret;
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  278  
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  279  	/*
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  280  	 * The mediatek,syscon-hdmi property contains a phandle link to the
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  281  	 * MMSYS_CONFIG device and the register offset of the HDMI_SYS_CFG
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  282  	 * registers it contains.
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  283  	 */
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  284  	hdmi->sys_regmap = syscon_regmap_lookup_by_phandle_args(np, "mediatek,syscon-hdmi",
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  285  								1, &hdmi->sys_offset);
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  286  	if (IS_ERR(hdmi->sys_regmap))
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  287  		return dev_err_probe(dev, PTR_ERR(hdmi->sys_regmap),
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  288  				     "Failed to get system configuration registers\n");
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  289  
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  290  	hdmi->cec_dev = &cec_pdev->dev;
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  291  	return 0;
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  292  }
86b1e68fe0869bd AngeloGioacchino Del Regno 2025-10-23  293  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki