All of lore.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, t.stanislaws@samsung.com,
	patches@linaro.org
Subject: Re: [PATCH v2 1/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in hdmi_drv.c
Date: Thu, 02 May 2013 12:23:21 +0200	[thread overview]
Message-ID: <51823E99.9040201@samsung.com> (raw)
In-Reply-To: <1367471009-7103-1-git-send-email-sachin.kamat@linaro.org>

Hi Sachin,

On 05/02/2013 07:03 AM, Sachin Kamat wrote:
> NULL check on clocks obtained using common clock APIs should not
> be done. Use IS_ERR only.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
> Changes since v1:
> Initialised clocks to invalid value.
> ---
>  drivers/media/platform/s5p-tv/hdmi_drv.c |   18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/platform/s5p-tv/hdmi_drv.c b/drivers/media/platform/s5p-tv/hdmi_drv.c
> index 4e86626..ed1a695 100644
> --- a/drivers/media/platform/s5p-tv/hdmi_drv.c
> +++ b/drivers/media/platform/s5p-tv/hdmi_drv.c
> @@ -765,15 +765,15 @@ static void hdmi_resources_cleanup(struct hdmi_device *hdev)
>  		regulator_bulk_free(res->regul_count, res->regul_bulk);
>  	/* kfree is NULL-safe */
>  	kfree(res->regul_bulk);
> -	if (!IS_ERR_OR_NULL(res->hdmiphy))
> +	if (!IS_ERR(res->hdmiphy))
>  		clk_put(res->hdmiphy);
> -	if (!IS_ERR_OR_NULL(res->sclk_hdmiphy))
> +	if (!IS_ERR(res->sclk_hdmiphy))
>  		clk_put(res->sclk_hdmiphy);
> -	if (!IS_ERR_OR_NULL(res->sclk_pixel))
> +	if (!IS_ERR(res->sclk_pixel))
>  		clk_put(res->sclk_pixel);
> -	if (!IS_ERR_OR_NULL(res->sclk_hdmi))
> +	if (!IS_ERR(res->sclk_hdmi))
>  		clk_put(res->sclk_hdmi);
> -	if (!IS_ERR_OR_NULL(res->hdmi))
> +	if (!IS_ERR(res->hdmi))
>  		clk_put(res->hdmi);
>  	memset(res, 0, sizeof(*res));

Shouldn't this memset be removed not ? Then res->regul_count would need to
be set to 0.

>  }
> @@ -793,8 +793,14 @@ static int hdmi_resources_init(struct hdmi_device *hdev)
>  	dev_dbg(dev, "HDMI resource init\n");
>  
>  	memset(res, 0, sizeof(*res));

This could be replaced with
	res->regul_count = 0;

> -	/* get clocks, power */
>  
> +	res->hdmi	 = ERR_PTR(-EINVAL);

You could remove this line, as res->sclk_hdmi will be set by clk_get()
right below.

> +	res->sclk_hdmi	 = ERR_PTR(-EINVAL);
> +	res->sclk_pixel	 = ERR_PTR(-EINVAL);
> +	res->sclk_hdmiphy = ERR_PTR(-EINVAL);
> +	res->hdmiphy	 = ERR_PTR(-EINVAL);
> +
> +	/* get clocks, power */
>  	res->hdmi = clk_get(dev, "hdmi");
>  	if (IS_ERR(res->hdmi)) {
>  		dev_err(dev, "failed to get clock 'hdmi'\n");
> 

Regards,
Sylwester

      parent reply	other threads:[~2013-05-02 10:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-02  5:03 [PATCH v2 1/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in hdmi_drv.c Sachin Kamat
2013-05-02  5:03 ` [PATCH v2 2/2] s5p-tv: Fix incorrect usage of IS_ERR_OR_NULL in mixer_drv.c Sachin Kamat
2013-05-02 10:23 ` Sylwester Nawrocki [this message]

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=51823E99.9040201@samsung.com \
    --to=s.nawrocki@samsung.com \
    --cc=linux-media@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=sachin.kamat@linaro.org \
    --cc=t.stanislaws@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 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.