All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shawn Lin <shawn.lin@rock-chips.com>
To: Heiko Stuebner <heiko@sntech.de>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-clk@vger.kernel.org, linux-rockchip@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Shawn Lin <shawn.lin@rock-chips.com>
Subject: [PATCH 4/6] clk: rockchip: don't return NULL when registering mmc branch fails
Date: Mon, 15 Feb 2016 11:33:41 +0800	[thread overview]
Message-ID: <1455507221-13078-1-git-send-email-shawn.lin@rock-chips.com> (raw)
In-Reply-To: <1455507153-12914-1-git-send-email-shawn.lin@rock-chips.com>

Avoid return NULL if rockchip_clk_register_mmc fails, otherwise
rockchip_clk_register_branches print "unknown clock type". The acutal
case is that it's a known clock type but we fail to regiser it, which
may makes user confuse the reason of failure.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 drivers/clk/rockchip/clk-mmc-phase.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/rockchip/clk-mmc-phase.c b/drivers/clk/rockchip/clk-mmc-phase.c
index 2685644..e0dc7e8 100644
--- a/drivers/clk/rockchip/clk-mmc-phase.c
+++ b/drivers/clk/rockchip/clk-mmc-phase.c
@@ -150,7 +150,7 @@ struct clk *rockchip_clk_register_mmc(const char *name,
 
 	mmc_clock = kmalloc(sizeof(*mmc_clock), GFP_KERNEL);
 	if (!mmc_clock)
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 
 	init.name = name;
 	init.num_parents = num_parents;
@@ -172,11 +172,7 @@ struct clk *rockchip_clk_register_mmc(const char *name,
 
 	clk = clk_register(NULL, &mmc_clock->hw);
 	if (IS_ERR(clk))
-		goto err_free;
+		kfree(mmc_clock);
 
 	return clk;
-
-err_free:
-	kfree(mmc_clock);
-	return NULL;
 }
-- 
2.3.7

  parent reply	other threads:[~2016-02-15  3:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15  3:32 [PATCH 0/6] Some trivial fixes for rockchip clk/pm stuff Shawn Lin
2016-02-15  3:33 ` [PATCH 1/6] clk: rockchip: handle alt_parent in err cases when registering cpuclk Shawn Lin
2016-02-15 21:39   ` Heiko Stuebner
2016-02-15  3:33 ` [PATCH 2/6] clk: rockchip: check grf when waiting pll lock Shawn Lin
2016-02-15 21:40   ` Heiko Stuebner
2016-02-15  3:33 ` [PATCH 3/6] clk: rockchip: don't return NULL when registering inverter fails Shawn Lin
2016-02-15 22:41   ` Heiko Stuebner
2016-02-15  3:33 ` Shawn Lin [this message]
2016-02-15 22:42   ` [PATCH 4/6] clk: rockchip: don't return NULL when registering mmc branch fails Heiko Stuebner
2016-02-15  3:33 ` [PATCH 5/6] clk: rockchip: fix coding style for clk-cpu.c Shawn Lin
2016-02-15 22:42   ` Heiko Stuebner
2016-02-15  3:33 ` [PATCH 6/6] soc: rockchip: power-domain: check the existing of regmap Shawn Lin
2016-02-15 21:26   ` Heiko Stuebner

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=1455507221-13078-1-git-send-email-shawn.lin@rock-chips.com \
    --to=shawn.lin@rock-chips.com \
    --cc=heiko@sntech.de \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@codeaurora.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.