linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: [PATCH] sound: fsl: add missing put_device() call in imx_hdmi_probe()
@ 2021-12-09  9:58 王擎
  2021-12-20 11:33 ` Shengjiu Wang
  0 siblings, 1 reply; 4+ messages in thread
From: 王擎 @ 2021-12-09  9:58 UTC (permalink / raw)
  To: Mark Brown
  Cc: Nicolin Chen, Xiubo Li, Fabio Estevam, Shengjiu Wang,
	Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, NXP Linux Team,
	alsa-devel, linuxppc-dev, linux-arm-kernel, linux-kernel


>> From: Wang Qing <wangqing@vivo.com>
>> 
>> of_find_device_by_node() takes a reference to the embedded struct device 
>> which needs to be dropped when error return.
>
>...
>
>>        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.
>

Label fail will drop a reference on the OF node.
Also, put_device() is called later except this branch, 
we just need to add put_device() here.

Thanks,
Qing

>>                ret = -ENOMEM;
>>                 goto fail;

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [PATCH] sound: fsl: add missing put_device() call in imx_hdmi_probe()
@ 2021-12-07 12:56 Qing Wang
  2021-12-08 14:05 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Qing Wang @ 2021-12-07 12:56 UTC (permalink / raw)
  To: Nicolin Chen, Xiubo Li, Fabio Estevam, Shengjiu Wang,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, NXP Linux Team,
	alsa-devel, linuxppc-dev, linux-arm-kernel, linux-kernel
  Cc: Wang Qing

From: Wang Qing <wangqing@vivo.com>

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

Signed-off-by: Wang Qing <wangqing@vivo.com>
---
 sound/soc/fsl/imx-hdmi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/fsl/imx-hdmi.c b/sound/soc/fsl/imx-hdmi.c
index 929f69b..89fd8ad
--- a/sound/soc/fsl/imx-hdmi.c
+++ b/sound/soc/fsl/imx-hdmi.c
@@ -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;
 	}
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-20 11:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-09  9:58 [PATCH] sound: fsl: add missing put_device() call in imx_hdmi_probe() 王擎
2021-12-20 11:33 ` Shengjiu Wang
  -- strict thread matches above, loose matches on Subject: below --
2021-12-07 12:56 Qing Wang
2021-12-08 14:05 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).