Skip to contentSkip to conversation

drm/msm: Remove bad calls to of_node_put()

PATCH In review Archit Taneja 2 participants 2 messages Nov 17, 2016 – Nov 18, 2016

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

PATCH 1/1 drm/msm: Remove bad calls to of_node_put()

In add_components_mdp, we parse the endpoints in MDP output ports using the helper for_each_endpoint_of_node(). Our function calls of_node_put() on the endpoint node before we iterate over the next one. This is already done by the helper, and results in trying to decrement the refcount twice.

Remove the extra of_node_put calls. This fixes warnings seen when we try to insert the driver as a module on IFC6410.

---
 drivers/gpu/drm/msm/msm_drv.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +2 -7
index 46568fc..5cabe1b 100644
@@ -903,10 +903,8 @@ static int add_components_mdp(struct device *mdp_dev,
 		 * remote-endpoint isn't a component that we need to add
 		 */
 		if (of_device_is_compatible(np, "qcom,mdp4") &&
-		    ep.port == 0) {
-			of_node_put(ep_node);
+		    ep.port == 0)
 			continue;
-		}
 
 		/*
 		 * It's okay if some of the ports don't have a remote endpoint
@@ -914,15 +912,12 @@ static int add_components_mdp(struct device *mdp_dev,
 		 * any external interface.
 		 */
 		intf = of_graph_get_remote_port_parent(ep_node);
-		if (!intf) {
-			of_node_put(ep_node);
+		if (!intf)
 			continue;
-		}
 
 		component_match_add(master_dev, matchptr, compare_of, intf);
 
 		of_node_put(intf);
-		of_node_put(ep_node);
 	}
 
 	return 0;
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 8 lines · Archit Taneja

In add_components_mdp, we parse the endpoints in MDP output ports using the helper for_each_endpoint_of_node(). Our function calls of_node_put() on the endpoint node before we iterate over the next one. This is already done by the helper, and results in trying to decrement the refcount twice.

Remove the extra of_node_put calls. This fixes warnings seen when we try to insert the driver as a module on IFC6410.

thanks.. fwiw, I've also seen this error on at least one of db{410,820}c..

BR,
-R

Quoted 43 lines
---
 drivers/gpu/drm/msm/msm_drv.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +2 -8
index 46568fc..5cabe1b 100644
@@ -903,10 +903,8 @@ static int add_components_mdp(struct device *mdp_dev,
                 * remote-endpoint isn't a component that we need to add
                 */
                if (of_device_is_compatible(np, "qcom,mdp4") &&
-                   ep.port == 0) {
-                       of_node_put(ep_node);
+                   ep.port == 0)
                        continue;
-               }
 
                /*
                 * It's okay if some of the ports don't have a remote endpoint
@@ -914,15 +912,12 @@ static int add_components_mdp(struct device *mdp_dev,
                 * any external interface.
                 */
                intf = of_graph_get_remote_port_parent(ep_node);
-               if (!intf) {
-                       of_node_put(ep_node);
+               if (!intf)
                        continue;
-               }
 
                component_match_add(master_dev, matchptr, compare_of, intf);
 
                of_node_put(intf);
-               of_node_put(ep_node);
        }
 
        return 0;
--

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation