public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: Sachin Kamat <sachin.kamat@linaro.org>
Cc: linux-media@vger.kernel.org, patches@linaro.org,
	Shaik Ameer Basha <shaik.ameer@samsung.com>
Subject: Re: [PATCH 1/4] [media] exynos-gsc: Rearrange error messages for valid prints
Date: Fri, 23 Nov 2012 10:31:10 +0100	[thread overview]
Message-ID: <50AF425E.9030203@samsung.com> (raw)
In-Reply-To: <1353645902-7467-2-git-send-email-sachin.kamat@linaro.org>

Hi Sachin,

Thanks for the patches.

On 11/23/2012 05:44 AM, Sachin Kamat wrote:
> In case of clk_prepare failure, the function gsc_clk_get also prints
> "failed to get clock" which is not correct. Hence move the error
> messages to their respective blocks. While at it, also renamed the labels
> meaningfully.
> 
> Cc: Shaik Ameer Basha <shaik.ameer@samsung.com>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/media/platform/exynos-gsc/gsc-core.c |   19 ++++++++++---------
>  1 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c
> index 6d6f65d..45bcfa7 100644
> --- a/drivers/media/platform/exynos-gsc/gsc-core.c
> +++ b/drivers/media/platform/exynos-gsc/gsc-core.c
> @@ -1017,25 +1017,26 @@ static int gsc_clk_get(struct gsc_dev *gsc)
>  	dev_dbg(&gsc->pdev->dev, "gsc_clk_get Called\n");
>  
>  	gsc->clock = clk_get(&gsc->pdev->dev, GSC_CLOCK_GATE_NAME);
> -	if (IS_ERR(gsc->clock))
> -		goto err_print;
> +	if (IS_ERR(gsc->clock)) {
> +		dev_err(&gsc->pdev->dev, "failed to get clock~~~: %s\n",
> +			GSC_CLOCK_GATE_NAME);
> +		goto err_clk_get;

You could also just return PTR_ERR(gsc->clock) here and remove
err_clk_get label entirely.		

> +	}
>  
>  	ret = clk_prepare(gsc->clock);
>  	if (ret < 0) {
> +		dev_err(&gsc->pdev->dev, "clock prepare failed for clock: %s\n",
> +			GSC_CLOCK_GATE_NAME);
>  		clk_put(gsc->clock);
>  		gsc->clock = NULL;
> -		goto err;
> +		goto err_clk_prepare;
>  	}
>  
>  	return 0;
>  
> -err:
> -	dev_err(&gsc->pdev->dev, "clock prepare failed for clock: %s\n",
> -					GSC_CLOCK_GATE_NAME);
> +err_clk_prepare:
>  	gsc_clk_put(gsc);

This call can be removed too. I would remove all labels and gotos in
this function. Since there is only one clock, you need to only call
clk_put when clk_prepare() fails, there is no need for gsc_clk_put().

> -err_print:
> -	dev_err(&gsc->pdev->dev, "failed to get clock~~~: %s\n",
> -					GSC_CLOCK_GATE_NAME);
> +err_clk_get:
>  	return -ENXIO;
>  }

As a general remark, I think changes like in this series have to be
validated before we can think of applying it. I guess Shaik or
somebody else would need to test it. I still have no board I could
test Exynos5 Gscaler IP.

--

Regards,
Sylwester

  reply	other threads:[~2012-11-23  9:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-23  4:44 [PATCH 0/4] [media] exynos-gsc: Some fixes Sachin Kamat
2012-11-23  4:44 ` [PATCH 1/4] [media] exynos-gsc: Rearrange error messages for valid prints Sachin Kamat
2012-11-23  9:31   ` Sylwester Nawrocki [this message]
2012-11-23  9:47     ` Sachin Kamat
2012-11-23  9:58       ` Sylwester Nawrocki
2012-11-23  4:45 ` [PATCH 2/4] [media] exynos-gsc: Remove gsc_clk_put call from gsc_clk_get Sachin Kamat
2012-11-23  9:51   ` Sylwester Nawrocki
2012-11-23  4:45 ` [PATCH 3/4] [media] exynos-gsc: Use devm_clk_get() Sachin Kamat
2012-11-23  4:45 ` [PATCH 4/4] [media] exynos-gsc: Fix checkpatch warning in gsc-m2m.c Sachin Kamat

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=50AF425E.9030203@samsung.com \
    --to=s.nawrocki@samsung.com \
    --cc=linux-media@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=sachin.kamat@linaro.org \
    --cc=shaik.ameer@samsung.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