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: <87eg78oxzt.fsf@eliezer.anholt.net>
Date:	Tue, 05 Jul 2016 09:23:02 -0700
From:	Eric Anholt <eric@...olt.net>
To:	Peter Chen <peter.chen@....com>, airlied@...ux.ie
Cc:	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
	Peter Chen <peter.chen@....com>
Subject: Re: [PATCH 7/7] gpu: drm: vc4_hdmi: add missing of_node_put after calling of_parse_phandle

Peter Chen <peter.chen@....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@...olt.net>
> Signed-off-by: Peter Chen <peter.chen@....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@...olt.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.

Download attachment "signature.asc" of type "application/pgp-signature" (819 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ