Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
* [PATCH] drm/bridge: imx: Use of_node_put(remote) call only once in imx8qxp_pc_bridge_probe()
@ 2024-09-17 15:00 Markus Elfring
  2024-09-23  9:04 ` Liu Ying
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2024-09-17 15:00 UTC (permalink / raw)
  To: imx, dri-devel, linux-arm-kernel, kernel, Andrzej Hajda,
	David Airlie, Fabio Estevam, Jernej Skrabec, Jonas Karlman,
	Laurent Pinchart, Liu Ying, Maarten Lankhorst, Maxime Ripard,
	Neil Armstrong, Robert Foss, Sascha Hauer, Shawn Guo,
	Simona Vetter, Thomas Zimmermann
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 17 Sep 2024 16:40:18 +0200

A of_node_put(remote) call was immediately used after a null pointer check
for the data structure member “next_bridge” in this
function implementation.
Thus use such a function call only once instead directly before the check.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
index e6dbbdc87ce2..0064d37ad8f6 100644
--- a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
+++ b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
@@ -321,8 +321,8 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
 		}

 		ch->next_bridge = of_drm_find_bridge(remote);
+		of_node_put(remote);
 		if (!ch->next_bridge) {
-			of_node_put(remote);
 			ret = -EPROBE_DEFER;
 			DRM_DEV_DEBUG_DRIVER(dev,
 					     "channel%u failed to find next bridge: %d\n",
@@ -330,8 +330,6 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
 			goto free_child;
 		}

-		of_node_put(remote);
-
 		ch->bridge.driver_private = ch;
 		ch->bridge.funcs = &imx8qxp_pc_bridge_funcs;
 		ch->bridge.of_node = child;
--
2.46.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/bridge: imx: Use of_node_put(remote) call only once in imx8qxp_pc_bridge_probe()
  2024-09-17 15:00 [PATCH] drm/bridge: imx: Use of_node_put(remote) call only once in imx8qxp_pc_bridge_probe() Markus Elfring
@ 2024-09-23  9:04 ` Liu Ying
  0 siblings, 0 replies; 2+ messages in thread
From: Liu Ying @ 2024-09-23  9:04 UTC (permalink / raw)
  To: Markus Elfring, imx, dri-devel, linux-arm-kernel, kernel,
	Andrzej Hajda, David Airlie, Fabio Estevam, Jernej Skrabec,
	Jonas Karlman, Laurent Pinchart, Maarten Lankhorst, Maxime Ripard,
	Neil Armstrong, Robert Foss, Sascha Hauer, Shawn Guo,
	Simona Vetter, Thomas Zimmermann
  Cc: LKML

On 09/17/2024, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 17 Sep 2024 16:40:18 +0200
> 
> A of_node_put(remote) call was immediately used after a null pointer check
> for the data structure member “next_bridge” in this
> function implementation.
> Thus use such a function call only once instead directly before the check.
> 
> This issue was transformed by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

The patch subject should be something like

drm/bridge: imx8qxp-pixel-combiner: Call of_node_put(remote) only once in probe function

so that the prefixes may tell the driver the patch touches,
just like some other previous patches did for this driver
shown by 'git log'.

Not sure if it is worth a v2 just for that.
Maybe, a patch committer can fix it before pushing.

With the patch subject fixed:
Reviewed-by: Liu Ying <victor.liu@nxp.com>

> 
> diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
> index e6dbbdc87ce2..0064d37ad8f6 100644
> --- a/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
> +++ b/drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c
> @@ -321,8 +321,8 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
>  		}
> 
>  		ch->next_bridge = of_drm_find_bridge(remote);
> +		of_node_put(remote);
>  		if (!ch->next_bridge) {
> -			of_node_put(remote);
>  			ret = -EPROBE_DEFER;
>  			DRM_DEV_DEBUG_DRIVER(dev,
>  					     "channel%u failed to find next bridge: %d\n",
> @@ -330,8 +330,6 @@ static int imx8qxp_pc_bridge_probe(struct platform_device *pdev)
>  			goto free_child;
>  		}
> 
> -		of_node_put(remote);
> -
>  		ch->bridge.driver_private = ch;
>  		ch->bridge.funcs = &imx8qxp_pc_bridge_funcs;
>  		ch->bridge.of_node = child;
> --
> 2.46.0
> 

-- 
Regards,
Liu Ying


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-09-23  9:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-17 15:00 [PATCH] drm/bridge: imx: Use of_node_put(remote) call only once in imx8qxp_pc_bridge_probe() Markus Elfring
2024-09-23  9:04 ` Liu Ying

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox