mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: Liang He <windhl@126.com>,
	airlied@linux.ie, daniel@ffwll.ch, khilman@baylibre.com,
	jbrunet@baylibre.com, martin.blumenstingl@googlemail.com,
	dri-devel@lists.freedesktop.org,
	linux-amlogic@lists.infradead.org
Subject: Re: [PATCH] drm/meson: Fix refcount bugs in meson_vpu_has_available_connectors()
Date: Mon, 8 Aug 2022 09:43:03 +0200	[thread overview]
Message-ID: <ba811c93-62ac-b8ad-8b06-d76dd7b5f33b@baylibre.com> (raw)
In-Reply-To: <20220726010722.1319416-1-windhl@126.com>

On 26/07/2022 03:07, Liang He wrote:
> In this function, there are two refcount leak bugs:
> (1) when breaking out of for_each_endpoint_of_node(), we need call
> the of_node_put() for the 'ep';
> (2) we should call of_node_put() for the reference returned by
> of_graph_get_remote_port() when it is not used anymore.
> 
> Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller")
> Signed-off-by: Liang He <windhl@126.com>
> Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
>   drivers/gpu/drm/meson/meson_drv.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 1b70938cfd2c..bd4ca11d3ff5 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -115,8 +115,11 @@ static bool meson_vpu_has_available_connectors(struct device *dev)
>   	for_each_endpoint_of_node(dev->of_node, ep) {
>   		/* If the endpoint node exists, consider it enabled */
>   		remote = of_graph_get_remote_port(ep);
> -		if (remote)
> +		if (remote) {
> +			of_node_put(remote);
> +			of_node_put(ep);
>   			return true;
> +		}
>   	}
>   
>   	return false;

Acked-by: Neil Armstrong <narmstrong@baylibre.com>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2022-08-08  7:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26  1:07 Liang He
2022-08-08  7:43 ` Neil Armstrong [this message]
2022-08-08  7:52 ` Neil Armstrong

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=ba811c93-62ac-b8ad-8b06-d76dd7b5f33b@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=windhl@126.com \
    /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®