All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wang Yufen <wangyufen@huawei.com>
To: <p.zabel@pengutronix.de>, <airlied@gmail.com>, <daniel@ffwll.ch>
Cc: Wang Yufen <wangyufen@huawei.com>, dri-devel@lists.freedesktop.org
Subject: [PATCH] gpu: ipu-v3: fix refcount leak in ipu_add_client_devices()
Date: Sun, 4 Dec 2022 22:01:01 +0800	[thread overview]
Message-ID: <1670162461-29521-1-git-send-email-wangyufen@huawei.com> (raw)

The node returned by of_graph_get_port_by_id() with refcount incremented,
of_node_put() needs be called when finish using it. So add it in the
error path in ipu_add_client_devices().

Fixes: 17e052175039 ("gpu: ipu-v3: Do not bail out on missing optional port nodes")
Signed-off-by: Wang Yufen <wangyufen@huawei.com>
---
 drivers/gpu/ipu-v3/ipu-common.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
index 1183185..80587f5 100644
--- a/drivers/gpu/ipu-v3/ipu-common.c
+++ b/drivers/gpu/ipu-v3/ipu-common.c
@@ -1164,6 +1164,7 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
 
 		pdev = platform_device_alloc(reg->name, id++);
 		if (!pdev) {
+			of_node_put(of_node);
 			ret = -ENOMEM;
 			goto err_register;
 		}
-- 
1.8.3.1


                 reply	other threads:[~2022-12-04 18:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1670162461-29521-1-git-send-email-wangyufen@huawei.com \
    --to=wangyufen@huawei.com \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=p.zabel@pengutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.