diff mbox series

video: fbdev: Fix missing of_node_put in imxfb_probe

Message ID 20220407090122.2491922-1-lv.ruyi@zte.com.cn (mailing list archive)
State Accepted, archived
Headers show
Series video: fbdev: Fix missing of_node_put in imxfb_probe | expand

Commit Message

CGEL April 7, 2022, 9:01 a.m. UTC
From: Lv Ruyi <lv.ruyi@zte.com.cn>

of_parse_phandle returns node pointer with refcount incremented,
use of_node_put() on it when done.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
---
 drivers/video/fbdev/imxfb.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Helge Deller April 7, 2022, 7:41 p.m. UTC | #1
On 4/7/22 11:01, cgel.zte@gmail.com wrote:
> From: Lv Ruyi <lv.ruyi@zte.com.cn>
>
> of_parse_phandle returns node pointer with refcount incremented,
> use of_node_put() on it when done.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>

applied.
Thanks!
Helge

> ---
>  drivers/video/fbdev/imxfb.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
> index 68288756ffff..a2f644c97f28 100644
> --- a/drivers/video/fbdev/imxfb.c
> +++ b/drivers/video/fbdev/imxfb.c
> @@ -925,10 +925,12 @@ static int imxfb_probe(struct platform_device *pdev)
>  				sizeof(struct imx_fb_videomode), GFP_KERNEL);
>  		if (!fbi->mode) {
>  			ret = -ENOMEM;
> +			of_node_put(display_np);
>  			goto failed_of_parse;
>  		}
>
>  		ret = imxfb_of_read_mode(&pdev->dev, display_np, fbi->mode);
> +		of_node_put(display_np);
>  		if (ret)
>  			goto failed_of_parse;
>  	}
diff mbox series

Patch

diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
index 68288756ffff..a2f644c97f28 100644
--- a/drivers/video/fbdev/imxfb.c
+++ b/drivers/video/fbdev/imxfb.c
@@ -925,10 +925,12 @@  static int imxfb_probe(struct platform_device *pdev)
 				sizeof(struct imx_fb_videomode), GFP_KERNEL);
 		if (!fbi->mode) {
 			ret = -ENOMEM;
+			of_node_put(display_np);
 			goto failed_of_parse;
 		}
 
 		ret = imxfb_of_read_mode(&pdev->dev, display_np, fbi->mode);
+		of_node_put(display_np);
 		if (ret)
 			goto failed_of_parse;
 	}