From: Neil Armstrong <narmstrong@baylibre.com>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: David Airlie <airlied@linux.ie>,
Kevin Hilman <khilman@baylibre.com>,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, Daniel Vetter <daniel@ffwll.ch>,
linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/3] drm/meson: add missing of_node_put
Date: Mon, 14 Jan 2019 16:32:58 +0100 [thread overview]
Message-ID: <30e505cf-fdfa-b546-c75d-5eb23366f7bb@baylibre.com> (raw)
In-Reply-To: <1547372691-28324-4-git-send-email-Julia.Lawall@lip6.fr>
Hi Julia,
On 13/01/2019 10:44, Julia Lawall wrote:
> Add an of_node_put when the result of of_graph_get_remote_port_parent is
> not available.
>
> An of_node_put is also needed when meson_probe_remote completes. This was
> present at the recursive call, but not in the call from meson_drv_probe.
>
> The semantic match that finds this problem is as follows
> (http://coccinelle.lip6.fr):
>
> // <smpl>
> @r exists@
> local idexpression e;
> expression x;
> @@
> e = of_graph_get_remote_port_parent(...);
> ... when != x = e
> when != true e == NULL
> when != of_node_put(e)
> when != of_fwnode_handle(e)
> (
> return e;
> |
> *return ...;
> )
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
And applied to drm-misc-fixes.
Neil
>
> ---
> drivers/gpu/drm/meson/meson_drv.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 3ee4d4a4e..b59c757 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -388,8 +388,10 @@ static int meson_probe_remote(struct platform_device *pdev,
> remote_node = of_graph_get_remote_port_parent(ep);
> if (!remote_node ||
> remote_node == parent || /* Ignore parent endpoint */
> - !of_device_is_available(remote_node))
> + !of_device_is_available(remote_node)) {
> + of_node_put(remote_node);
> continue;
> + }
>
> count += meson_probe_remote(pdev, match, remote, remote_node);
>
> @@ -408,10 +410,13 @@ static int meson_drv_probe(struct platform_device *pdev)
>
> for_each_endpoint_of_node(np, ep) {
> remote = of_graph_get_remote_port_parent(ep);
> - if (!remote || !of_device_is_available(remote))
> + if (!remote || !of_device_is_available(remote)) {
> + of_node_put(remote);
> continue;
> + }
>
> count += meson_probe_remote(pdev, &match, np, remote);
> + of_node_put(remote);
> }
>
> if (count && !match)
>
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
prev parent reply other threads:[~2019-01-14 15:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-13 9:44 [PATCH 0/3] " Julia Lawall
2019-01-13 9:44 ` [PATCH 3/3] drm/meson: " Julia Lawall
2019-01-14 15:32 ` Neil Armstrong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=30e505cf-fdfa-b546-c75d-5eb23366f7bb@baylibre.com \
--to=narmstrong@baylibre.com \
--cc=Julia.Lawall@lip6.fr \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®