All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
To: Fabio Estevam <festevam@gmail.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/fsl-dcu: check for clk_prepare_enable() error
Date: Wed, 28 Dec 2016 16:38:35 -0200	[thread overview]
Message-ID: <874m1n6gr8.fsf@dilma.collabora.co.uk> (raw)
In-Reply-To: <1482943728-29421-2-git-send-email-festevam@gmail.com> (Fabio Estevam's message of "Wed, 28 Dec 2016 14:48:48 -0200")

Fabio Estevam <festevam@gmail.com> writes:

> From: Fabio Estevam <fabio.estevam@nxp.com>
>
> clk_prepare_enable() may fail, so we should better check its return 
> value.
>
> Also place the of_node_put() function right after clk_prepare_enable(),
> in order to avoid calling of_node_put() twice in case clk_prepare_enable()
> fails.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
>  drivers/gpu/drm/fsl-dcu/fsl_tcon.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_tcon.c b/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
> index 2fbb7ee..b3d70a6 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
> @@ -87,9 +87,13 @@ struct fsl_tcon *fsl_tcon_init(struct device *dev)
>  		goto err_node_put;
>  	}
>  
> -	of_node_put(np);
> -	clk_prepare_enable(tcon->ipg_clk);
> +	ret = clk_prepare_enable(tcon->ipg_clk);
> +	if (ret) {
> +		dev_err(dev, "Couldn't enable the TCON clock\n");
> +		goto err_node_put;
> +	}

This leaks tcon if clk_prepare_enable fails.

>  
> +	of_node_put(np);
>  	dev_info(dev, "Using TCON in bypass mode\n");
>  
>  	return tcon;
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-12-28 18:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-28 16:48 [PATCH 1/2] drm/fsl-dcu: remove unneeded 'ret' assignment Fabio Estevam
2016-12-28 16:48 ` [PATCH 2/2] drm/fsl-dcu: check for clk_prepare_enable() error Fabio Estevam
2016-12-28 18:38   ` Gabriel Krisman Bertazi [this message]
2016-12-28 18:44     ` Fabio Estevam
2016-12-28 18:53       ` Gabriel Krisman Bertazi
2016-12-29  7:12         ` Stefan Agner
2016-12-28 18:49 ` [PATCH 1/2] drm/fsl-dcu: remove unneeded 'ret' assignment Gabriel Krisman Bertazi
2017-02-08  5:11 ` Stefan Agner

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=874m1n6gr8.fsf@dilma.collabora.co.uk \
    --to=krisman@collabora.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fabio.estevam@nxp.com \
    --cc=festevam@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.