RE: [PATCH] sound: fsl: add missing put_device() call in imx_hdmi_probe()

2 messages, 2 authors, 2021-12-20 · open the first message on its own page

RE: [PATCH] sound: fsl: add missing put_device() call in imx_hdmi_probe()

From: 王擎 <hidden>
Date: 2021-12-09 09:58:58

quoted
From: Wang Qing <redacted>

of_find_device_by_node() takes a reference to the embedded struct device 
which needs to be dropped when error return.
...
quoted
       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
quoted
               ret = -ENOMEM;
                goto fail;

Re: [PATCH] sound: fsl: add missing put_device() call in imx_hdmi_probe()

From: Shengjiu Wang <shengjiu.wang@gmail.com>
Date: 2021-12-20 11:33:59

On Thu, Dec 9, 2021 at 5:58 PM 王擎 [off-list ref] wrote:
quoted
quoted
From: Wang Qing <redacted>

of_find_device_by_node() takes a reference to the embedded struct device
which needs to be dropped when error return.
...
quoted
       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.
I agree with you. But could you please add the info in this
commit that
the commit:
f670b274f7f6 ASoC: imx-hdmi: add put_device() after of_find_device_by_node()
is partially fixing the original issue, so we still need this fix.

Best regards
Wang Shengjiu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help