Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1334128

[PATCH 4/6] clk: rockchip: don't return NULL when registering mmc branch fails

From Shawn Lin <shawn.lin@rock-chips.com>
Newsgroups linux.kernel
Subject [PATCH 4/6] clk: rockchip: don't return NULL when registering mmc branch fails
Date 2016-02-15 04:40 +0100
Message-ID <r2ib0-3Gn-25@gated-at.bofh.it> (permalink)
References <r2iaZ-3Gn-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] Some trivial fixes for rockchip clk/pm stuff Shawn Lin <shawn.lin@rock-chips.com> - 2016-02-15 04:40 +0100
  [PATCH 4/6] clk: rockchip: don't return NULL when registering mmc branch fails Shawn Lin <shawn.lin@rock-chips.com> - 2016-02-15 04:40 +0100
    Re: [PATCH 4/6] clk: rockchip: don't return NULL when registering mmc branch fails Heiko Stuebner <heiko@sntech.de> - 2016-02-15 23:50 +0100
  [PATCH 1/6] clk: rockchip: handle alt_parent in err cases when registering cpuclk Shawn Lin <shawn.lin@rock-chips.com> - 2016-02-15 04:40 +0100
    Re: [PATCH 1/6] clk: rockchip: handle alt_parent in err cases when registering cpuclk Heiko Stuebner <heiko@sntech.de> - 2016-02-15 22:40 +0100

csiph-web