public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Eric Anholt <eric@anholt.net>
Cc: Peter Chen <peter.chen@nxp.com>,
	airlied@linux.ie, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 7/7] gpu: drm: vc4_hdmi: add missing of_node_put after calling of_parse_phandle
Date: Tue, 12 Jul 2016 15:47:02 +0200	[thread overview]
Message-ID: <20160712134702.GC23520@phenom.ffwll.local> (raw)
In-Reply-To: <87eg78oxzt.fsf@eliezer.anholt.net>

On Tue, Jul 05, 2016 at 09:23:02AM -0700, Eric Anholt wrote:
> Peter Chen <peter.chen@nxp.com> writes:
> 
> > of_node_put needs to be called when the device node which is got
> > from of_parse_phandle has finished using.
> >
> > Cc: Eric Anholt <eric@anholt.net>
> > Signed-off-by: Peter Chen <peter.chen@nxp.com>
> > ---
> >  drivers/gpu/drm/vc4/vc4_hdmi.c | 13 +++++++------
> >  1 file changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> > index fd2644d..26b6b06 100644
> > --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> > +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> > @@ -465,12 +465,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
> >  	if (IS_ERR(hdmi->hd_regs))
> >  		return PTR_ERR(hdmi->hd_regs);
> >  
> > -	ddc_node = of_parse_phandle(dev->of_node, "ddc", 0);
> > -	if (!ddc_node) {
> > -		DRM_ERROR("Failed to find ddc node in device tree\n");
> > -		return -ENODEV;
> > -	}
> > -
> >  	hdmi->pixel_clock = devm_clk_get(dev, "pixel");
> >  	if (IS_ERR(hdmi->pixel_clock)) {
> >  		DRM_ERROR("Failed to get pixel clock\n");
> > @@ -482,7 +476,14 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
> >  		return PTR_ERR(hdmi->hsm_clock);
> >  	}
> >  
> > +	ddc_node = of_parse_phandle(dev->of_node, "ddc", 0);
> > +	if (!ddc_node) {
> > +		DRM_ERROR("Failed to find ddc node in device tree\n");
> > +		return -ENODEV;
> > +	}
> > +
> >  	hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
> > +	of_node_put(ddc_node);
> >  	if (!hdmi->ddc) {
> >  		DRM_DEBUG("Failed to get ddc i2c adapter by node\n");
> >  		return -EPROBE_DEFER;
> > -- 
> 
> Reviewed-by: Eric Anholt <eric@anholt.net>
> 
> It would be nice if we could just pass the phandle spec directly to the
> i2c function.  OF code always seems terribly verbose to me (and
> error-prone in this exact way) because of the separate phandle lookup.

Yeah, of_find_i2c_adapter_by_phandle would be neat. Either way, applied
all the other patches to drm-misc.
-Daniel



> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2016-07-12 13:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05  2:04 [PATCH 0/7] gpu: drm: remaining missing of_node_put issue fixes Peter Chen
2016-07-05  2:04 ` [PATCH 1/7] gpu: drm: rockchip_drm_drv: add missing of_node_put after calling of_parse_phandle Peter Chen
2016-07-05  2:04 ` [PATCH 2/7] gpu: drm: sti_compositor: " Peter Chen
2016-07-12 12:59   ` Benjamin Gaignard
2016-07-05  2:04 ` [PATCH 3/7] gpu: drm: sti_vdo: " Peter Chen
2016-07-12 12:59   ` Benjamin Gaignard
2016-07-05  2:04 ` [PATCH 4/7] gpu: drm: sti_hqvdp: " Peter Chen
2016-07-12 12:59   ` Benjamin Gaignard
2016-07-05  2:04 ` [PATCH 5/7] gpu: drm: sti_vtg: " Peter Chen
2016-07-12 12:59   ` Benjamin Gaignard
2016-07-05  2:04 ` [PATCH 6/7] gpu: drm: sun4i_drv: " Peter Chen
2016-07-05  7:20   ` Maxime Ripard
2016-07-05  2:04 ` [PATCH 7/7] gpu: drm: vc4_hdmi: " Peter Chen
2016-07-05 16:23   ` Eric Anholt
2016-07-12 13:47     ` Daniel Vetter [this message]
2016-07-08  1:46   ` Eric Anholt

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=20160712134702.GC23520@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eric@anholt.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter.chen@nxp.com \
    /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