soc: bcm: brcmstb: add of_node_put()
PATCH 1/1 soc: bcm: brcmstb: add of_node_put()
of_find_node_by_path() acquires a reference to the node returned by it and that reference needs to be dropped by its caller. bl_idle_init() doesn't do that, so fix it.
--- drivers/soc/bcm/brcmstb/common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/soc/bcm/brcmstb/common.c +4 -1
@@ -32,12 +32,15 @@ static const struct of_device_id brcmstb_machine_match[] = {bool soc_is_brcmstb (void ) {struct device_node *root; +bool rc; root =of_find_node_by_path ("/" );if (!root)return false; -return of_match_node (brcmstb_machine_match, root) !=NULL ; + rc =of_match_node (brcmstb_machine_match, root) !=NULL ; +of_node_put (root); +return rc; }u32 brcmstb_get_family_id (void )
Signature · 1 line
2.17.0
Quoted 3 lines · Yangtao Li
of_find_node_by_path()acquires a reference to the node returned by it and that reference needs to be dropped by its caller.bl_idle_init()doesn't do that, so fix it.
You probably copied/pasted this from a prior patch, the function name is soc_is_brcmstb() here, do you mind fixing that and also providing a
Fixes: tag?
Thanks
Quoted 28 lines
Signed-off-by Yangtao Li <[email protected]>--- drivers/soc/bcm/brcmstb/common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/soc/bcm/brcmstb/common.c +4
-1@@ -32,12 +32,15 @@ static const struct of_device_id brcmstb_machine_match[] = {bool soc_is_brcmstb (void ) {struct device_node *root; +bool rc; root =of_find_node_by_path ("/" );if (!root)return false; -return of_match_node (brcmstb_machine_match, root) !=NULL ; + rc =of_match_node (brcmstb_machine_match, root) !=NULL ; +of_node_put (root); +return rc; }u32 brcmstb_get_family_id (void )
Signature · 1 line
Florian
Quoted 11 lines · Florian Fainelli
Quoted 3 lines · Yangtao Li
of_find_node_by_path()acquires a reference to the node returned by it and that reference needs to be dropped by its caller.bl_idle_init()doesn't do that, so fix it.You probably copied/pasted this from a prior patch, the function name is
soc_is_brcmstb()here, do you mind fixing that and also providing a
Fixes: tag?
Hi Florian:
Do you need me to send a patch that changed the commit log or refactor the soc_is_brcmstb()?
For example:
https://lore.kernel.org/patchwork/patch/1015523/
Yours,
Yangtao
Quoted 34 lines
Thanks
Quoted 18 lines
Signed-off-by Yangtao Li <[email protected]>--- drivers/soc/bcm/brcmstb/common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/soc/bcm/brcmstb/common.c +1
-0@@ -32,12 +32,15 @@ static const struct of_device_id brcmstb_machine_match[] = {bool soc_is_brcmstb (void ) {struct device_node *root; +bool rc; root =of_find_node_by_path ("/" );drivers/soc/bcm/brcmstb/common.c static const struct of_device_id brcmstb_machine_match[] = { · line 46
Quoted 10 lines
drivers/soc/bcm/brcmstb/common.c +3
-1if (!root)return false; -return of_match_node (brcmstb_machine_match, root) !=NULL ; + rc =of_match_node (brcmstb_machine_match, root) !=NULL ; +of_node_put (root); +return rc; }u32 brcmstb_get_family_id (void )--
Florian