Skip to contentSkip to conversation

sound: fsl: add missing put_device() call in imx_hdmi_probe()

PATCH In review Qing Wang 2 participants 2 messages Dec 7, 2021 – Dec 8, 2021

Subsystems (4)
lore
Share & tools
lore

Qing Wang

author
#0 lore raw

PATCH 1/1 sound: fsl: add missing put_device() call in imx_hdmi_probe()

From: Wang Qing <[email protected]>

of_find_device_by_node() takes a reference to the embedded struct device which needs to be dropped when error return.

---
 sound/soc/fsl/imx-hdmi.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/fsl/imx-hdmi.c +1 -0
index 929f69b..89fd8ad
@@ -125,6 +125,7 @@ static int imx_hdmi_probe(struct platform_device *pdev)
 
 	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
 	if (!data) {
+		put_device(&cpu_pdev->dev);
 		ret = -ENOMEM;
 		goto fail;
 	}
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 4 lines · Qing Wang

From: Wang Qing <[email protected]>

of_find_device_by_node() takes a reference to the embedded struct device which needs to be dropped when error return.

...

sound/soc/fsl/imx-hdmi.c static int imx_hdmi_probe(struct platform_device *pdev) · line 128

Quoted 3 lines
sound/soc/fsl/imx-hdmi.c +1 -0
 	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
 	if (!data) {
+		put_device(&cpu_pdev->dev);

If it's of_find_device_by_node() you need an of_node_put() since you're dropping a reference on the OF node.