All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Mike Turquette <mturquette@linaro.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>,
	Carlo Caione <carlo@endlessm.com>,
	linux-clk@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] clk: meson: add some error handling in meson_clk_register_cpu()
Date: Thu, 11 Jun 2015 15:20:46 +0000	[thread overview]
Message-ID: <20150611152046.GG12192@mwanda> (raw)

This error handling hopefully isn't needed but it make the static
checkers happy.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/clk/meson/clk-cpu.c b/drivers/clk/meson/clk-cpu.c
index 148e99f..71ad493 100644
--- a/drivers/clk/meson/clk-cpu.c
+++ b/drivers/clk/meson/clk-cpu.c
@@ -213,22 +213,30 @@ struct clk *meson_clk_register_cpu(const struct clk_conf *clk_conf,
 	if (!pclk) {
 		pr_err("%s: could not lookup parent clock %s\n",
 				__func__, clk_conf->clks_parent[0]);
-		return ERR_PTR(-EINVAL);
+		ret = -EINVAL;
+		goto free_clk;
 	}
 
 	ret = clk_notifier_register(pclk, &clk_cpu->clk_nb);
 	if (ret) {
 		pr_err("%s: failed to register clock notifier for %s\n",
 				__func__, clk_conf->clk_name);
-		return ERR_PTR(-EINVAL);
+		goto free_clk;
 	}
 
 	clk = clk_register(NULL, &clk_cpu->hw);
 	if (IS_ERR(clk)) {
-		clk_notifier_unregister(pclk, &clk_cpu->clk_nb);
-		kfree(clk_cpu);
+		ret = PTR_ERR(clk);
+		goto unregister_clk_nb;
 	}
 
 	return clk;
+
+unregister_clk_nb:
+	clk_notifier_unregister(pclk, &clk_cpu->clk_nb);
+free_clk:
+	kfree(clk_cpu);
+
+	return ERR_PTR(ret);
 }
 

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Mike Turquette <mturquette@linaro.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>,
	Carlo Caione <carlo@endlessm.com>,
	linux-clk@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] clk: meson: add some error handling in meson_clk_register_cpu()
Date: Thu, 11 Jun 2015 18:20:46 +0300	[thread overview]
Message-ID: <20150611152046.GG12192@mwanda> (raw)

This error handling hopefully isn't needed but it make the static
checkers happy.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/clk/meson/clk-cpu.c b/drivers/clk/meson/clk-cpu.c
index 148e99f..71ad493 100644
--- a/drivers/clk/meson/clk-cpu.c
+++ b/drivers/clk/meson/clk-cpu.c
@@ -213,22 +213,30 @@ struct clk *meson_clk_register_cpu(const struct clk_conf *clk_conf,
 	if (!pclk) {
 		pr_err("%s: could not lookup parent clock %s\n",
 				__func__, clk_conf->clks_parent[0]);
-		return ERR_PTR(-EINVAL);
+		ret = -EINVAL;
+		goto free_clk;
 	}
 
 	ret = clk_notifier_register(pclk, &clk_cpu->clk_nb);
 	if (ret) {
 		pr_err("%s: failed to register clock notifier for %s\n",
 				__func__, clk_conf->clk_name);
-		return ERR_PTR(-EINVAL);
+		goto free_clk;
 	}
 
 	clk = clk_register(NULL, &clk_cpu->hw);
 	if (IS_ERR(clk)) {
-		clk_notifier_unregister(pclk, &clk_cpu->clk_nb);
-		kfree(clk_cpu);
+		ret = PTR_ERR(clk);
+		goto unregister_clk_nb;
 	}
 
 	return clk;
+
+unregister_clk_nb:
+	clk_notifier_unregister(pclk, &clk_cpu->clk_nb);
+free_clk:
+	kfree(clk_cpu);
+
+	return ERR_PTR(ret);
 }
 

             reply	other threads:[~2015-06-11 15:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11 15:20 Dan Carpenter [this message]
2015-06-11 15:20 ` [patch] clk: meson: add some error handling in meson_clk_register_cpu() Dan Carpenter
2015-06-11 15:26 ` Carlo Caione
2015-06-11 15:26   ` Carlo Caione
2015-06-11 23:13 ` Stephen Boyd
2015-06-11 23:13   ` Stephen Boyd

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=20150611152046.GG12192@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=carlo@endlessm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=mturquette@linaro.org \
    --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.