All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
To: linux-renesas-soc@vger.kernel.org,
	"Jacopo Mondi" <jacopo@jmondi.org>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Niklas Söderlund" <niklas.soderlund@ragnatech.se>
Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Subject: [PATCH] max9286: balance v4l2_async refcnting
Date: Thu, 13 Feb 2020 10:21:35 +0000	[thread overview]
Message-ID: <20200213102135.2179-1-kieran.bingham+renesas@ideasonboard.com> (raw)
In-Reply-To: <20200212173727.19476-1-kieran.bingham+renesas@ideasonboard.com>

When we add fwnodes to V4L2 notifiers through
v4l2_async_notifier_add_subdev they are stored internally in V4L2 core,
and have a reference count released upon any call to
v4l2_async_notifier_cleanup().

Ensure that any source successfully added to a notifier gets its fwnode
reference count increased accordingly.

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
---
 drivers/media/i2c/max9286.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
index f3311210a666..62615e6ab710 100644
--- a/drivers/media/i2c/max9286.c
+++ b/drivers/media/i2c/max9286.c
@@ -665,6 +665,11 @@ static int max9286_v4l2_async_register(struct max9286_priv *priv)
 			v4l2_async_notifier_cleanup(&priv->notifier);
 			return ret;
 		}
+
+		/* Balance the refernce counting handled through
+		 * v4l2_async_notifier_cleanup()
+		 */
+		fwnode_handle_get(source->fwnode);
 	}
 
 	priv->notifier.ops = &max9286_notify_ops;
-- 
2.20.1


  parent reply	other threads:[~2020-02-13 10:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12 17:37 [PATCH 0/2] max9286: Refactor V4L2 support to prevent EPROBE_DEFER failures Kieran Bingham
2020-02-12 17:37 ` [PATCH 1/2] max9286: Split out async registration Kieran Bingham
2020-02-12 17:39   ` Kieran Bingham
2020-02-13  9:46   ` Jacopo Mondi
2020-02-13 10:07     ` Kieran Bingham
2020-02-13 10:15       ` Kieran Bingham
2020-02-13 10:20       ` Jacopo Mondi
2020-02-13 10:27         ` Kieran Bingham
2020-02-13 11:41           ` Jacopo Mondi
2020-02-12 17:37 ` [PATCH 2/2] max9286: Collect all V4L2 registrations Kieran Bingham
2020-02-13 10:21 ` Kieran Bingham [this message]
2020-02-13 13:06   ` [PATCH] max9286: balance v4l2_async refcnting Kieran Bingham
2020-02-13 13:11     ` Jacopo Mondi
2020-02-13 13:28       ` Kieran Bingham

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=20200213102135.2179-1-kieran.bingham+renesas@ideasonboard.com \
    --to=kieran.bingham+renesas@ideasonboard.com \
    --cc=jacopo@jmondi.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    /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.