diff mbox series

ARM: OMAP2+: adjust the location of put_device() call in omapdss_init_of

Message ID 20211116062726.154689-1-ye.guojin@zte.com.cn (mailing list archive)
State New, archived
Headers show
Series ARM: OMAP2+: adjust the location of put_device() call in omapdss_init_of | expand

Commit Message

CGEL Nov. 16, 2021, 6:27 a.m. UTC
From: Ye Guojin <ye.guojin@zte.com.cn>

This was found by coccicheck:
./arch/arm/mach-omap2/display.c, 272, 1-7, ERROR missing put_device;
call of_find_device_by_node on line 258, but without a corresponding
object release within this function.

Move the put_device() call before the if judgment.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
---
 arch/arm/mach-omap2/display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tony Lindgren Dec. 17, 2021, 12:14 p.m. UTC | #1
* cgel.zte@gmail.com <cgel.zte@gmail.com> [211116 08:28]:
> From: Ye Guojin <ye.guojin@zte.com.cn>
> 
> This was found by coccicheck:
> ./arch/arm/mach-omap2/display.c, 272, 1-7, ERROR missing put_device;
> call of_find_device_by_node on line 258, but without a corresponding
> object release within this function.
> 
> Move the put_device() call before the if judgment.

Thanks applying into omap-for-v5.17/fixes-not-urgent.

Tony
diff mbox series

Patch

diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 6daaa645ae5d..21413a9b7b6c 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -263,9 +263,9 @@  static int __init omapdss_init_of(void)
 	}
 
 	r = of_platform_populate(node, NULL, NULL, &pdev->dev);
+	put_device(&pdev->dev);
 	if (r) {
 		pr_err("Unable to populate DSS submodule devices\n");
-		put_device(&pdev->dev);
 		return r;
 	}