[PATCH v4 2/8] imx-drm: Do not decrement endpoint node refcount in the loop

From: Philipp Zabel
Date: Mon Sep 29 2014 - 04:16:53 EST


In preparation for the following patch, stop decrementing the endpoint node
refcount in the loop. This temporarily leaks a reference to the endpoint node,
which will be fixed by having of_graph_get_next_endpoint decrement the refcount
of its prev argument instead.

Signed-off-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
---
Changes since v3:
- Rebased on top of 30e94a564d079f71f53368733720caa0c7c413c8
(staging: imx-drm: Lines over 80 characters fixed.), which
added a blank line in imx_drm_of_get_next_endpoint.
---
drivers/staging/imx-drm/imx-drm-core.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c
index 4289cc8..fab79ad 100644
--- a/drivers/staging/imx-drm/imx-drm-core.c
+++ b/drivers/staging/imx-drm/imx-drm-core.c
@@ -435,15 +435,6 @@ static uint32_t imx_drm_find_crtc_mask(struct imx_drm_device *imxdrm,
return 0;
}

-static struct device_node *imx_drm_of_get_next_endpoint(
- const struct device_node *parent, struct device_node *prev)
-{
- struct device_node *node = of_graph_get_next_endpoint(parent, prev);
-
- of_node_put(prev);
- return node;
-}
-
int imx_drm_encoder_parse_of(struct drm_device *drm,
struct drm_encoder *encoder, struct device_node *np)
{
@@ -455,7 +446,7 @@ int imx_drm_encoder_parse_of(struct drm_device *drm,
for (i = 0; ; i++) {
u32 mask;

- ep = imx_drm_of_get_next_endpoint(np, ep);
+ ep = of_graph_get_next_endpoint(np, ep);
if (!ep)
break;

@@ -503,7 +494,7 @@ int imx_drm_encoder_get_mux_id(struct device_node *node,
return -EINVAL;

do {
- ep = imx_drm_of_get_next_endpoint(node, ep);
+ ep = of_graph_get_next_endpoint(node, ep);
if (!ep)
break;

--
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/