Skip to contentSkip to conversation

drm/bridge: imx: Use of_node_put(remote) call only once in imx8qxp_pc_bridge_probe()

PATCH In review Markus Elfring 2 participants 2 messages Sep 17, 2024 – Sep 23, 2024

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/bridge: imx: Use of_node_put(remote) call only once in imx8qxp_pc_bridge_probe()

From: Markus Elfring <[email protected]>
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.

---
 drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c +1 -3
index e6dbbdc87ce2..0064d37ad8f6 100644
@@ -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

maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Markus Elfring

From: Markus Elfring <[email protected]>
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.

Quoted 6 lines

This issue was transformed by using the Coccinelle software.

---
 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:

Quoted 27 lines
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c +1 -4
index e6dbbdc87ce2..0064d37ad8f6 100644
@@ -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

Signature · 2 lines
Regards,
Liu Ying