All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Kukjin Kim <kgene.kim@samsung.com>
Cc: mturquette@linaro.org, linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org,
	Thomas Abraham <thomas.abraham@linaro.org>,
	t.figa@samsung.com, Russell King <linux@arm.linux.org.uk>
Subject: [PATCH v2 2/6] clk: samsung: fix error handling in pll register functions
Date: Wed, 10 Jul 2013 00:58:13 +0200	[thread overview]
Message-ID: <201307100058.13941.heiko@sntech.de> (raw)
In-Reply-To: <201307100057.06061.heiko@sntech.de>

kmalloc has its own error reporting when the allocation fails and
the register functions also should return the correct ERR_PTR(-ENOMEM)
when it happens.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/clk/samsung/clk-pll.c |   30 ++++++++++--------------------
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c
index 9153e46..0afaec6 100644
--- a/drivers/clk/samsung/clk-pll.c
+++ b/drivers/clk/samsung/clk-pll.c
@@ -79,10 +79,8 @@ struct clk * __init samsung_clk_register_pll35xx(const char *name,
 	struct clk_init_data init;
 
 	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
-	if (!pll) {
-		pr_err("%s: could not allocate pll clk %s\n", __func__, name);
-		return NULL;
-	}
+	if (!pll)
+		return ERR_PTR(-ENOMEM);
 
 	init.name = name;
 	init.ops = &samsung_pll35xx_clk_ops;
@@ -153,10 +151,8 @@ struct clk * __init samsung_clk_register_pll36xx(const char *name,
 	struct clk_init_data init;
 
 	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
-	if (!pll) {
-		pr_err("%s: could not allocate pll clk %s\n", __func__, name);
-		return NULL;
-	}
+	if (!pll)
+		return ERR_PTR(-ENOMEM);
 
 	init.name = name;
 	init.ops = &samsung_pll36xx_clk_ops;
@@ -227,10 +223,8 @@ struct clk * __init samsung_clk_register_pll45xx(const char *name,
 	struct clk_init_data init;
 
 	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
-	if (!pll) {
-		pr_err("%s: could not allocate pll clk %s\n", __func__, name);
-		return NULL;
-	}
+	if (!pll)
+		return ERR_PTR(-ENOMEM);
 
 	init.name = name;
 	init.ops = &samsung_pll45xx_clk_ops;
@@ -308,10 +302,8 @@ struct clk * __init samsung_clk_register_pll46xx(const char *name,
 	struct clk_init_data init;
 
 	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
-	if (!pll) {
-		pr_err("%s: could not allocate pll clk %s\n", __func__, name);
-		return NULL;
-	}
+	if (!pll)
+		return ERR_PTR(-ENOMEM);
 
 	init.name = name;
 	init.ops = &samsung_pll46xx_clk_ops;
@@ -385,10 +377,8 @@ struct clk * __init samsung_clk_register_pll2550x(const char *name,
 	struct clk_init_data init;
 
 	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
-	if (!pll) {
-		pr_err("%s: could not allocate pll clk %s\n", __func__, name);
-		return NULL;
-	}
+	if (!pll)
+		return ERR_PTR(-ENOMEM);
 
 	init.name = name;
 	init.ops = &samsung_pll2550x_clk_ops;
-- 
1.7.10.4

WARNING: multiple messages have this Message-ID (diff)
From: heiko@sntech.de (Heiko Stübner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/6] clk: samsung: fix error handling in pll register functions
Date: Wed, 10 Jul 2013 00:58:13 +0200	[thread overview]
Message-ID: <201307100058.13941.heiko@sntech.de> (raw)
In-Reply-To: <201307100057.06061.heiko@sntech.de>

kmalloc has its own error reporting when the allocation fails and
the register functions also should return the correct ERR_PTR(-ENOMEM)
when it happens.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/clk/samsung/clk-pll.c |   30 ++++++++++--------------------
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c
index 9153e46..0afaec6 100644
--- a/drivers/clk/samsung/clk-pll.c
+++ b/drivers/clk/samsung/clk-pll.c
@@ -79,10 +79,8 @@ struct clk * __init samsung_clk_register_pll35xx(const char *name,
 	struct clk_init_data init;
 
 	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
-	if (!pll) {
-		pr_err("%s: could not allocate pll clk %s\n", __func__, name);
-		return NULL;
-	}
+	if (!pll)
+		return ERR_PTR(-ENOMEM);
 
 	init.name = name;
 	init.ops = &samsung_pll35xx_clk_ops;
@@ -153,10 +151,8 @@ struct clk * __init samsung_clk_register_pll36xx(const char *name,
 	struct clk_init_data init;
 
 	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
-	if (!pll) {
-		pr_err("%s: could not allocate pll clk %s\n", __func__, name);
-		return NULL;
-	}
+	if (!pll)
+		return ERR_PTR(-ENOMEM);
 
 	init.name = name;
 	init.ops = &samsung_pll36xx_clk_ops;
@@ -227,10 +223,8 @@ struct clk * __init samsung_clk_register_pll45xx(const char *name,
 	struct clk_init_data init;
 
 	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
-	if (!pll) {
-		pr_err("%s: could not allocate pll clk %s\n", __func__, name);
-		return NULL;
-	}
+	if (!pll)
+		return ERR_PTR(-ENOMEM);
 
 	init.name = name;
 	init.ops = &samsung_pll45xx_clk_ops;
@@ -308,10 +302,8 @@ struct clk * __init samsung_clk_register_pll46xx(const char *name,
 	struct clk_init_data init;
 
 	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
-	if (!pll) {
-		pr_err("%s: could not allocate pll clk %s\n", __func__, name);
-		return NULL;
-	}
+	if (!pll)
+		return ERR_PTR(-ENOMEM);
 
 	init.name = name;
 	init.ops = &samsung_pll46xx_clk_ops;
@@ -385,10 +377,8 @@ struct clk * __init samsung_clk_register_pll2550x(const char *name,
 	struct clk_init_data init;
 
 	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
-	if (!pll) {
-		pr_err("%s: could not allocate pll clk %s\n", __func__, name);
-		return NULL;
-	}
+	if (!pll)
+		return ERR_PTR(-ENOMEM);
 
 	init.name = name;
 	init.ops = &samsung_pll2550x_clk_ops;
-- 
1.7.10.4

  parent reply	other threads:[~2013-07-09 22:58 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-09 22:57 [PATCH v2 0/6] Convert S3C2416 ad S3C2443 to common clock framework Heiko Stübner
2013-07-09 22:57 ` Heiko Stübner
2013-07-09 22:57 ` [PATCH v2 1/6] clk: samsung: move common plls registration into separate function Heiko Stübner
2013-07-09 22:57   ` Heiko Stübner
2013-07-10 16:59   ` Yadwinder Singh Brar
2013-07-10 16:59     ` Yadwinder Singh Brar
2013-07-11  7:46     ` Tomasz Figa
2013-07-11  7:46       ` Tomasz Figa
2013-07-11  8:52       ` Heiko Stübner
2013-07-11  8:52         ` Heiko Stübner
2013-08-02 21:35         ` Mike Turquette
2013-08-02 21:35           ` Mike Turquette
2013-07-09 22:58 ` Heiko Stübner [this message]
2013-07-09 22:58   ` [PATCH v2 2/6] clk: samsung: fix error handling in pll register functions Heiko Stübner
2013-07-11  7:50   ` Tomasz Figa
2013-07-11  7:50     ` Tomasz Figa
2013-07-09 22:59 ` [PATCH v2 3/6] clk: samsung: add plls used in s3c2416 and s3c2443 Heiko Stübner
2013-07-09 22:59   ` Heiko Stübner
2013-07-11  8:16   ` Tomasz Figa
2013-07-11  8:16     ` Tomasz Figa
2013-07-11  8:50     ` Heiko Stübner
2013-07-11  8:50       ` Heiko Stübner
2013-07-11  9:25       ` Tomasz Figa
2013-07-11  9:25         ` Tomasz Figa
2013-07-09 22:59 ` [PATCH v2 4/6] ARM: S3C24XX: enable legacy clock code only when SAMSUNG_CLOCK selected Heiko Stübner
2013-07-09 22:59   ` Heiko Stübner
2013-07-09 23:00 ` [PATCH v2 5/6] clk: samsung: add clock-driver for s3c2416, s3c2443 and s3c2450 Heiko Stübner
2013-07-09 23:00   ` Heiko Stübner
2013-07-11  9:13   ` Tomasz Figa
2013-07-11  9:13     ` Tomasz Figa
2013-07-09 23:00 ` [PATCH v2 6/6] ARM: S3C24XX: Convert s3c2416 and s3c2443 to common clock framework Heiko Stübner
2013-07-09 23:00   ` Heiko Stübner
2013-07-16  7:09   ` Kukjin Kim
2013-07-16  7:09     ` Kukjin Kim
2013-07-22 17:07     ` Tomasz Figa
2013-07-22 17:07       ` Tomasz Figa
2013-07-24 12:59       ` Kukjin Kim
2013-07-24 12:59         ` Kukjin Kim
2013-07-24 14:01         ` Tomasz Figa
2013-07-24 14:01           ` Tomasz Figa
2013-08-05 17:03       ` Kukjin Kim
2013-08-05 17:03         ` Kukjin Kim
2013-07-10  8:47 ` [PATCH v2 0/6] Convert S3C2416 ad S3C2443 " Thomas Abraham
2013-07-10  8:47   ` Thomas Abraham
2013-08-05 17:05 ` Kukjin Kim
2013-08-05 17:05   ` Kukjin Kim

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=201307100058.13941.heiko@sntech.de \
    --to=heiko@sntech.de \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mturquette@linaro.org \
    --cc=t.figa@samsung.com \
    --cc=thomas.abraham@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.