mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ricardo Ribalda <ribalda@chromium.org>
To: Joseph Liu <kwliu@nuvoton.com>, Marvin Lin <kflin@nuvoton.com>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Hans Verkuil <hverkuil@xs4all.nl>,
	Philipp Zabel <p.zabel@pengutronix.de>
Cc: Marvin Lin <milkfafa@gmail.com>,
	linux-media@vger.kernel.org,  openbmc@lists.ozlabs.org,
	linux-kernel@vger.kernel.org,
	 Ricardo Ribalda <ribalda@chromium.org>,
	stable@vger.kernel.org
Subject: [PATCH 2/4] media: nuvoton: Fix reference handling of ece_node
Date: Tue, 21 Jan 2025 21:14:51 +0000	[thread overview]
Message-ID: <20250121-nuvoton-v1-2-1ea4f0cdbda2@chromium.org> (raw)
In-Reply-To: <20250121-nuvoton-v1-0-1ea4f0cdbda2@chromium.org>

Make sure all the code paths call of_node_put().

Cc: stable@vger.kernel.org
Fixes: 46c15a4ff1f4 ("media: nuvoton: Add driver for NPCM video capture and encoding engine")
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/platform/nuvoton/npcm-video.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/nuvoton/npcm-video.c b/drivers/media/platform/nuvoton/npcm-video.c
index 7b4c23dbe709..f6cba17a7924 100644
--- a/drivers/media/platform/nuvoton/npcm-video.c
+++ b/drivers/media/platform/nuvoton/npcm-video.c
@@ -1665,11 +1665,11 @@ static int npcm_video_ece_init(struct npcm_video *video)
 		dev_info(dev, "Support HEXTILE pixel format\n");
 
 		ece_pdev = of_find_device_by_node(ece_node);
+		of_node_put(ece_node);
 		if (!ece_pdev) {
 			dev_err(dev, "Failed to find ECE device\n");
 			return -ENODEV;
 		}
-		of_node_put(ece_node);
 
 		regs = devm_platform_ioremap_resource(ece_pdev, 0);
 		if (IS_ERR(regs)) {
@@ -1692,6 +1692,8 @@ static int npcm_video_ece_init(struct npcm_video *video)
 			dev_err(dev, "Failed to get ECE reset control in DTS\n");
 			return PTR_ERR(video->ece.reset);
 		}
+	} else {
+		of_node_put(ece_node);
 	}
 
 	return 0;

-- 
2.48.0.rc2.279.g1de40edade-goog


  parent reply	other threads:[~2025-01-21 21:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-21 21:14 [PATCH 0/4] media: nuvoton: Fix some reference handling issues Ricardo Ribalda
2025-01-21 21:14 ` [PATCH 1/4] media: nuvoton: Fix reference handling of ece_pdev Ricardo Ribalda
2025-02-21  9:04   ` Hans Verkuil
2025-02-21  9:18     ` Hans Verkuil
2025-02-23 18:34       ` Ricardo Ribalda
2025-02-24  5:52         ` Greg KH
2025-02-24  6:34           ` Ricardo Ribalda
2025-02-21 13:01     ` Markus Elfring
2025-01-21 21:14 ` Ricardo Ribalda [this message]
2025-01-21 21:14 ` [PATCH 3/4] media: nuvoton: Use cleanup.h macros for device_node Ricardo Ribalda
2025-01-21 21:14 ` [PATCH 4/4] media: nuvoton: Use cleanup.h macros for put_device Ricardo Ribalda

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=20250121-nuvoton-v1-2-1ea4f0cdbda2@chromium.org \
    --to=ribalda@chromium.org \
    --cc=hverkuil@xs4all.nl \
    --cc=kflin@nuvoton.com \
    --cc=kwliu@nuvoton.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=milkfafa@gmail.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=p.zabel@pengutronix.de \
    --cc=stable@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®