* [PATCH] ASoC: bcm: add missing call to of_node_put()
@ 2021-03-08 7:18 Yang Li
2021-03-08 20:10 ` Scott Branden
0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2021-03-08 7:18 UTC (permalink / raw)
To: perex
Cc: tiwai, rjui, sbranden, bcm-kernel-feedback-list, alsa-devel,
linux-arm-kernel, linux-kernel, lgirdwood, Yang Li
In one of the error paths of the for_each_child_of_node() loop,
add missing call to of_node_put().
Fix the following coccicheck warning:
./sound/soc/bcm/cygnus-ssp.c:1346:1-33: WARNING: Function
"for_each_available_child_of_node" should have of_node_put() before
return around line 1352.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
sound/soc/bcm/cygnus-ssp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/bcm/cygnus-ssp.c b/sound/soc/bcm/cygnus-ssp.c
index 6e634b4..aa16a23 100644
--- a/sound/soc/bcm/cygnus-ssp.c
+++ b/sound/soc/bcm/cygnus-ssp.c
@@ -1348,8 +1348,10 @@ static int cygnus_ssp_probe(struct platform_device *pdev)
&cygnus_ssp_dai[active_port_count]);
/* negative is err, 0 is active and good, 1 is disabled */
- if (err < 0)
+ if (err < 0) {
+ of_node_put(child_node);
return err;
+ }
else if (!err) {
dev_dbg(dev, "Activating DAI: %s\n",
cygnus_ssp_dai[active_port_count].name);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: bcm: add missing call to of_node_put()
2021-03-08 7:18 [PATCH] ASoC: bcm: add missing call to of_node_put() Yang Li
@ 2021-03-08 20:10 ` Scott Branden
0 siblings, 0 replies; 2+ messages in thread
From: Scott Branden @ 2021-03-08 20:10 UTC (permalink / raw)
To: Yang Li, perex
Cc: tiwai, rjui, sbranden, bcm-kernel-feedback-list, alsa-devel,
linux-arm-kernel, linux-kernel, lgirdwood
[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]
Hi Yang,
On 2021-03-07 11:18 p.m., Yang Li wrote:
> In one of the error paths of the for_each_child_of_node() loop,
> add missing call to of_node_put().
>
> Fix the following coccicheck warning:
> ./sound/soc/bcm/cygnus-ssp.c:1346:1-33: WARNING: Function
> "for_each_available_child_of_node" should have of_node_put() before
> return around line 1352.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
> sound/soc/bcm/cygnus-ssp.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/bcm/cygnus-ssp.c b/sound/soc/bcm/cygnus-ssp.c
> index 6e634b4..aa16a23 100644
> --- a/sound/soc/bcm/cygnus-ssp.c
> +++ b/sound/soc/bcm/cygnus-ssp.c
> @@ -1348,8 +1348,10 @@ static int cygnus_ssp_probe(struct platform_device *pdev)
> &cygnus_ssp_dai[active_port_count]);
>
> /* negative is err, 0 is active and good, 1 is disabled */
> - if (err < 0)
> + if (err < 0) {
> + of_node_put(child_node);
If such is needed in probe what about the other child_nodes in for_each_child_of_node loop that have already been parsed and succeeded. Do they need additional cleanup as well?
> return err;
> + }
> else if (!err) {
> dev_dbg(dev, "Activating DAI: %s\n",
> cygnus_ssp_dai[active_port_count].name);
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-08 20:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-08 7:18 [PATCH] ASoC: bcm: add missing call to of_node_put() Yang Li
2021-03-08 20:10 ` Scott Branden
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox