lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200514125445.GH2877@Mani-XPS-13-9360>
Date:   Thu, 14 May 2020 18:24:45 +0530
From:   Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
To:     Kieran Bingham <kieran.bingham@...asonboard.com>,
        y@...i-XPS-13-9360
Cc:     kieran.bingham+renesas@...asonboard.com,
        linux-renesas-soc@...r.kernel.org, linux-media@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        Jacopo Mondi <jacopo@...ndi.org>,
        Niklas Söderlund 
        <niklas.soderlund@...natech.se>, sakari.ailus@....fi,
        Hans Verkuil <hverkuil@...all.nl>,
        Hyun Kwon <hyunk@...inx.com>, Rob Herring <robh+dt@...nel.org>,
        Jacopo Mondi <jacopo+renesas@...ndi.org>,
        Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>,
        Niklas Söderlund 
        <niklas.soderlund+renesas@...natech.se>
Subject: Re: [PATCH v9 2/4] media: i2c: Add MAX9286 driver

On Thu, May 14, 2020 at 01:27:01PM +0100, Kieran Bingham wrote:
> Hi Mani,
> 
> On 14/05/2020 12:47, Kieran Bingham wrote:
> > On 14/05/2020 11:13, Manivannan Sadhasivam wrote:
> >> Hi Kieran,
> <snip>
> 
> >>>>> +static int max9286_parse_dt(struct max9286_priv *priv)
> >>>>> +{
> >>>>> +	struct device *dev = &priv->client->dev;
> >>>>> +	struct device_node *i2c_mux;
> >>>>> +	struct device_node *node = NULL;
> >>>>> +	unsigned int i2c_mux_mask = 0;
> >>>>> +
> >>>>> +	of_node_get(dev->of_node);
> >>>>
> >>>> Why this is needed?
> >>>
> >>> Hrm .. I recall adding it to solve dt reference balancing.
> >>>
> >>> I wish I'd added a comment at the time ... as I can't recall the details
> >>> now.
> >>>
> >>
> >> I understand that it is for the refcount balancing but I certainly don't see
> >> a need for it.
> > 
> > I'll go through and try to validate this again now.
> 
> Aha, that's why:
> 
>  *	of_find_node_by_name - Find a node by its "name" property
>  *	@from:	The node to start searching from or NULL; the node
>  *		you pass will not be searched, only the next one
>  *		will. Typically, you pass what the previous call
>  *		returned. of_node_put() will be called on @from.
>  *	@name:	The name string to match against
> 
> I'll add a comment to state that it is to balance the of_node_put during
> of_find_node_by_name().
> 

Ah, right. I mostly use of_find_node_by_name() with NULL, so didn't realize
this.

And yeah, a comment would be helpful.

Thanks,
Mani

> --
> Kieran
> 
> 
> >>>>> +	i2c_mux = of_find_node_by_name(dev->of_node, "i2c-mux");
> >>>>> +	if (!i2c_mux) {
> >>>>> +		dev_err(dev, "Failed to find i2c-mux node\n");
> >>>>> +		of_node_put(dev->of_node);
> >>>>> +		return -EINVAL;
> >>>>> +	}
> >>>>> +
> >> [...]
> >>>>
> -- 
> Regards
> --
> Kieran

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ