diff mbox series

max9286: balance v4l2_async refcnting

Message ID 20200213102135.2179-1-kieran.bingham+renesas@ideasonboard.com (mailing list archive)
State New
Delegated to: Kieran Bingham
Headers show
Series max9286: balance v4l2_async refcnting | expand

Commit Message

Kieran Bingham Feb. 13, 2020, 10:21 a.m. UTC
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(+)

Comments

Kieran Bingham Feb. 13, 2020, 1:06 p.m. UTC | #1
On 13/02/2020 10:21, Kieran Bingham wrote:
> 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

I've correctly moved this to a new line and fixed up the reference
spelling :)

> +		 * v4l2_async_notifier_cleanup()
> +		 */
> +		fwnode_handle_get(source->fwnode);
>  	}
>  
>  	priv->notifier.ops = &max9286_notify_ops;
>
Jacopo Mondi Feb. 13, 2020, 1:11 p.m. UTC | #2
Hi Kieran!

On Thu, Feb 13, 2020 at 01:06:31PM +0000, Kieran Bingham wrote:
> On 13/02/2020 10:21, Kieran Bingham wrote:
> > 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
>
> I've correctly moved this to a new line and fixed up the reference
> spelling :)

Good, thanks!

I think you could squash all of these in the next max9286 iteration!

Acked-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
   j
>
> > +		 * v4l2_async_notifier_cleanup()
> > +		 */
> > +		fwnode_handle_get(source->fwnode);
> >  	}
> >
> >  	priv->notifier.ops = &max9286_notify_ops;
> >
>
Kieran Bingham Feb. 13, 2020, 1:28 p.m. UTC | #3
On 13/02/2020 13:11, Jacopo Mondi wrote:
> Hi Kieran!
> 
> On Thu, Feb 13, 2020 at 01:06:31PM +0000, Kieran Bingham wrote:
>> On 13/02/2020 10:21, Kieran Bingham wrote:
>>> 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
>>
>> I've correctly moved this to a new line and fixed up the reference
>> spelling :)
> 
> Good, thanks!
> 
> I think you could squash all of these in the next max9286 iteration!
> 
> Acked-by: Jacopo Mondi <jacopo@jmondi.org>

Thankyou, I'll squash and rebase to linux-media/master branch!


 \o/

--
Kieran


> 
> Thanks
>    j
>>
>>> +		 * v4l2_async_notifier_cleanup()
>>> +		 */
>>> +		fwnode_handle_get(source->fwnode);
>>>  	}
>>>
>>>  	priv->notifier.ops = &max9286_notify_ops;
>>>
>>
diff mbox series

Patch

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;