All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel@collabora.com>
To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: kernel@collabora.com, Hans Verkuil <hverkuil@xs4all.nl>,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	Ezequiel Garcia <ezequiel@collabora.com>
Subject: [PATCH] media: v4l2-async: Put fwnode after last access
Date: Mon, 28 Dec 2020 09:17:25 -0300	[thread overview]
Message-ID: <20201228121725.133898-1-ezequiel@collabora.com> (raw)

fwnode_handle_put() should be called after the fwnode
is last accessed. Fix it.

Fixes: b98158d837ef ("media: v4l2-async: Accept endpoints and devices for fwnode matching")
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
 drivers/media/v4l2-core/v4l2-async.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index e3ab003a6c85..1303c9b83138 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -78,6 +78,7 @@ static bool match_fwnode(struct v4l2_async_notifier *notifier,
 	bool asd_fwnode_is_ep;
 	bool sd_fwnode_is_ep;
 	struct device *dev;
+	bool match;
 
 	/*
 	 * Both the subdev and the async subdev can provide either an endpoint
@@ -113,9 +114,10 @@ static bool match_fwnode(struct v4l2_async_notifier *notifier,
 		other_fwnode = sd->fwnode;
 	}
 
-	fwnode_handle_put(dev_fwnode);
+	match = (dev_fwnode == other_fwnode);
 
-	if (dev_fwnode != other_fwnode)
+	fwnode_handle_put(dev_fwnode);
+	if (!match)
 		return false;
 
 	/*
-- 
2.29.2


             reply	other threads:[~2020-12-28 12:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-28 12:17 Ezequiel Garcia [this message]
2020-12-28 13:16 ` [PATCH] media: v4l2-async: Put fwnode after last access Laurent Pinchart
2020-12-28 16:51   ` Ezequiel Garcia

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=20201228121725.133898-1-ezequiel@collabora.com \
    --to=ezequiel@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@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 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.