Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1441361 > unrolled thread

Re: [PATCH 7/7] gpu: drm: vc4_hdmi: add missing of_node_put after calling of_parse_phandle

Started byDaniel Vetter <daniel@ffwll.ch>
First post2016-07-12 15:50 +0200
Last post2016-07-12 15:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 7/7] gpu: drm: vc4_hdmi: add missing of_node_put after  calling of_parse_phandle Daniel Vetter <daniel@ffwll.ch> - 2016-07-12 15:50 +0200

#1441361 — Re: [PATCH 7/7] gpu: drm: vc4_hdmi: add missing of_node_put after calling of_parse_phandle

FromDaniel Vetter <daniel@ffwll.ch>
Date2016-07-12 15:50 +0200
SubjectRe: [PATCH 7/7] gpu: drm: vc4_hdmi: add missing of_node_put after calling of_parse_phandle
Message-ID<rU6eu-5CJ-5@gated-at.bofh.it>
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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web