All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH 09/10] fbdev: sh_mipi_dsi: add set_dot_clock() for each platform
Date: Thu, 15 Sep 2011 05:57:15 +0000	[thread overview]
Message-ID: <20110915055714.GA28503@linux-sh.org> (raw)
In-Reply-To: <87ehzqqabh.wl%kuninori.morimoto.gx@renesas.com>

On Fri, Sep 09, 2011 at 03:28:22AM -0700, Kuninori Morimoto wrote:
> +static int sh_mipi_set_dot_clock(struct platform_device *pdev,
> +				 void __iomem *base,
> +				 int enable)
> +{
> +	struct clk *pck;
> +	int ret = -EIO;
> +
> +	pck = clk_get(&pdev->dev, "dsip_clk");
> +	if (IS_ERR(pck))
> +		goto sh_mipi_set_dot_clock_pck_err;
> +
> +	if (enable) {
> +		clk_set_rate(pck, clk_round_rate(pck,  24000000));
> +		__raw_writel(0x2a809010, DSI0PHYCR);
> +		clk_enable(pck);
> +	} else {
> +		clk_disable(pck);
> +	}
> +
> +	ret = 0;
> +
> +	clk_put(pck);
> +
> +sh_mipi_set_dot_clock_pck_err:
> +	return ret;
> +}
> +
I'm not sure why you're using this convention of clobbering the return
value. There are a number of reasons why clk_get() could fail, and you're
simply discarding that information outright and unconditionally kicking
up -EIO. You should simply do this as:

	if (IS_ERR(...)) {
		ret = PTR_ERR(...);
		...
	}

in order to propagate the error value all the way down the chain. This
seems to apply to some of the other patches in this series, too.

  reply	other threads:[~2011-09-15  5:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-09 10:28 [PATCH 09/10] fbdev: sh_mipi_dsi: add set_dot_clock() for each platform Kuninori Morimoto
2011-09-15  5:57 ` Paul Mundt [this message]
2011-09-15  7:47 ` Kuninori Morimoto

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=20110915055714.GA28503@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=linux-sh@vger.kernel.org \
    /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.