All of lore.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
	spear-devel@list.st.com, linux-kernel@vger.kernel.org
Subject: [PATCH] pinctrl: plgpio: Call clk_disable_unprepare only if clk_prepare_enable is called
Date: Wed, 14 Nov 2012 16:37:45 +0800	[thread overview]
Message-ID: <1352882265.12579.2.camel@phoenix> (raw)

This driver allows clk_get() failure, and still work without it.
This patch adds !IS_ERR(plgpio->clk) checking in plgpio_request() error path
so we only call clk_disable_unprepare() if clk_prepare_enable() is called.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/pinctrl/spear/pinctrl-plgpio.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/spear/pinctrl-plgpio.c b/drivers/pinctrl/spear/pinctrl-plgpio.c
index 1044ad3..cf6d9c2 100644
--- a/drivers/pinctrl/spear/pinctrl-plgpio.c
+++ b/drivers/pinctrl/spear/pinctrl-plgpio.c
@@ -243,7 +243,8 @@ static int plgpio_request(struct gpio_chip *chip, unsigned offset)
 	return 0;
 
 err1:
-	clk_disable_unprepare(plgpio->clk);
+	if (!IS_ERR(plgpio->clk))
+		clk_disable_unprepare(plgpio->clk);
 err0:
 	pinctrl_free_gpio(gpio);
 	return ret;
-- 
1.7.9.5




             reply	other threads:[~2012-11-14  8:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-14  8:37 Axel Lin [this message]
2012-11-14  9:06 ` [PATCH] pinctrl: plgpio: Call clk_disable_unprepare only if clk_prepare_enable is called Viresh Kumar
2012-11-15 11:34 ` Linus Walleij

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=1352882265.12579.2.camel@phoenix \
    --to=axel.lin@ingics.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spear-devel@list.st.com \
    --cc=viresh.kumar@linaro.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.