Re: [PATCH v2] drm/meson: fix possible object reference leak

2019-04-09 Thread wen.yang99
> > v2->v1: convert a if statement into a ternary statement.
> 
> Would you like to omit the arrow in such version information?

Thank you for your comments
The information about the previous versions goes below the ---, 
and only the reviewers can see it.
It does not appear in the git log log.
Thanks.

> > @@ -720,15 +720,10 @@ static bool meson_hdmi_connector_is_available(struct 
> > device *dev)
> >
> >  /* If the endpoint node exists, consider it enabled */
> >  remote = of_graph_get_remote_port(ep);
> > -if (remote) {
> > -of_node_put(ep);
> > -return true;
> > -}
> > -
> >  of_node_put(ep);
> >  of_node_put(remote);
> 
> Can a reordering of the passed variables be useful for such function calls?
> 
> +  of_node_put(remote);
> +  of_node_put(ep);
> 

Thank you.
But considering the multiprocessor concurrent execution, 
the reverse of the order of these two statements may not have additional 
benefits.
The previous code implementation also maintains this order, 
and we will keep the original order unless we can prove that the reverse order 
can indeed bring real benefits.

--
Regards,
Wen___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v2] drm/meson: fix possible object reference leak

2019-04-09 Thread Markus Elfring
> v2->v1: convert a if statement into a ternary statement.

Would you like to omit the arrow in such version information?


> @@ -720,15 +720,10 @@ static bool meson_hdmi_connector_is_available(struct 
> device *dev)
>
>   /* If the endpoint node exists, consider it enabled */
>   remote = of_graph_get_remote_port(ep);
> - if (remote) {
> - of_node_put(ep);
> - return true;
> - }
> -
>   of_node_put(ep);
>   of_node_put(remote);

Can a reordering of the passed variables be useful for such function calls?

+   of_node_put(remote);
+   of_node_put(ep);

Regards,
Markus
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v2] drm/meson: fix possible object reference leak

2019-04-08 Thread Wen Yang
The call to of_graph_get_remote_port returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.

Detected by coccinelle with the following warnings:
drivers/gpu/drm/meson/meson_dw_hdmi.c:725:2-8: ERROR: missing of_node_put; 
acquired a node pointer with refcount incremented on line 722, but without a 
corresponding object release within this function.

Signed-off-by: Wen Yang 
Cc: Neil Armstrong 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Kevin Hilman 
Cc: dri-devel@lists.freedesktop.org
Cc: linux-amlo...@lists.infradead.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-ker...@vger.kernel.org
Cc: Markus Elfring 
---
v2->v1: convert a if statement into a ternary statement.

 drivers/gpu/drm/meson/meson_dw_hdmi.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c 
b/drivers/gpu/drm/meson/meson_dw_hdmi.c
index 563953e..826b98b 100644
--- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
+++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
@@ -720,15 +720,10 @@ static bool meson_hdmi_connector_is_available(struct 
device *dev)
 
/* If the endpoint node exists, consider it enabled */
remote = of_graph_get_remote_port(ep);
-   if (remote) {
-   of_node_put(ep);
-   return true;
-   }
-
of_node_put(ep);
of_node_put(remote);
 
-   return false;
+   return remote ? true : false;
 }
 
 static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
-- 
2.9.5

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel