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


Groups > linux.kernel > #1627196 > unrolled thread

[PATCH 0/8] clk: Fine-tuning for ten function implementations

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-04-20 10:30 +0200
Last post2017-04-22 04:50 +0200
Articles 6 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/8] clk: Fine-tuning for ten function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-20 10:30 +0200
    [PATCH 8/8] clk: nomadik: Delete error messages for a failed memory  allocation in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-20 10:40 +0200
    [PATCH 6/8] clk: Improve a size determination in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-20 10:40 +0200
      Re: [PATCH 6/8] clk: Improve a size determination in two functions Stephen Boyd <sboyd@codeaurora.org> - 2017-04-22 04:50 +0200
    [PATCH 7/8] clk: nomadik: Use seq_puts() in nomadik_src_clk_show() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-20 10:40 +0200
      Re: [PATCH 7/8] clk: nomadik: Use seq_puts() in  nomadik_src_clk_show() Stephen Boyd <sboyd@codeaurora.org> - 2017-04-22 04:50 +0200

#1627196 — [PATCH 0/8] clk: Fine-tuning for ten function implementations

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-20 10:30 +0200
Subject[PATCH 0/8] clk: Fine-tuning for ten function implementations
Message-ID<tyfDr-6zX-3@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 20 Apr 2017 10:12:34 +0200

Some update suggestions were taken into account
from static source code analysis.

Markus Elfring (8):
  Use devm_kcalloc() in si5351_i2c_probe()
  Delete an error message for a failed memory allocation in si5351_i2c_probe()
  Adjust a null pointer check in si5351_dt_parse()
  Replace four seq_printf() calls by seq_putc()
  Combine two seq_puts() calls into one call in clk_summary_show()
  Improve a size determination in two functions
  Use seq_puts() in nomadik_src_clk_show()
  Delete error messages for a failed memory allocation in two functions

 drivers/clk/clk-nomadik.c | 12 ++++--------
 drivers/clk/clk-si5351.c  | 10 ++++------
 drivers/clk/clk.c         | 19 +++++++++----------
 3 files changed, 17 insertions(+), 24 deletions(-)

-- 
2.12.2

[toc] | [next] | [standalone]


#1627205 — [PATCH 8/8] clk: nomadik: Delete error messages for a failed memory allocation in two functions

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-20 10:40 +0200
Subject[PATCH 8/8] clk: nomadik: Delete error messages for a failed memory allocation in two functions
Message-ID<tyfN8-6Do-15@gated-at.bofh.it>
In reply to#1627196
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 20 Apr 2017 10:04:00 +0200

The script "checkpatch.pl" pointed information out like the following.

WARNING: Possible unnecessary 'out of memory' message

Thus remove such statements here.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/clk/clk-nomadik.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c
index 8d57ab8d6ed8..13ad6d1e5090 100644
--- a/drivers/clk/clk-nomadik.c
+++ b/drivers/clk/clk-nomadik.c
@@ -267,10 +267,8 @@ pll_clk_register(struct device *dev, const char *name,
 	}
 
 	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
-	if (!pll) {
-		pr_err("%s: could not allocate PLL clk\n", __func__);
+	if (!pll)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	init.name = name;
 	init.ops = &pll_clk_ops;
@@ -356,11 +354,9 @@ src_clk_register(struct device *dev, const char *name,
 	struct clk_init_data init;
 
 	sclk = kzalloc(sizeof(*sclk), GFP_KERNEL);
-	if (!sclk) {
-		pr_err("could not allocate SRC clock %s\n",
-			name);
+	if (!sclk)
 		return ERR_PTR(-ENOMEM);
-	}
+
 	init.name = name;
 	init.ops = &src_clk_ops;
 	/* Do not force-disable the static SDRAM controller */
-- 
2.12.2

[toc] | [prev] | [next] | [standalone]


#1627206 — [PATCH 6/8] clk: Improve a size determination in two functions

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-20 10:40 +0200
Subject[PATCH 6/8] clk: Improve a size determination in two functions
Message-ID<tyfN8-6Do-13@gated-at.bofh.it>
In reply to#1627196
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 20 Apr 2017 09:30:52 +0200

Replace the specification of two data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/clk/clk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 684642ab4212..3f2ee0469d3e 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2939,7 +2939,7 @@ int clk_notifier_register(struct clk *clk, struct notifier_block *nb)
 
 	/* if clk wasn't in the notifier list, allocate new clk_notifier */
 	if (cn->clk != clk) {
-		cn = kzalloc(sizeof(struct clk_notifier), GFP_KERNEL);
+		cn = kzalloc(sizeof(*cn), GFP_KERNEL);
 		if (!cn)
 			goto out;
 
@@ -3087,7 +3087,7 @@ int of_clk_add_provider(struct device_node *np,
 	struct of_clk_provider *cp;
 	int ret;
 
-	cp = kzalloc(sizeof(struct of_clk_provider), GFP_KERNEL);
+	cp = kzalloc(sizeof(*cp), GFP_KERNEL);
 	if (!cp)
 		return -ENOMEM;
 
-- 
2.12.2

[toc] | [prev] | [next] | [standalone]


#1628746 — Re: [PATCH 6/8] clk: Improve a size determination in two functions

FromStephen Boyd <sboyd@codeaurora.org>
Date2017-04-22 04:50 +0200
SubjectRe: [PATCH 6/8] clk: Improve a size determination in two functions
Message-ID<tyThw-5w6-9@gated-at.bofh.it>
In reply to#1627206
On 04/20, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 20 Apr 2017 09:30:52 +0200
> 
> Replace the specification of two data structures by pointer dereferences
> as the parameter for the operator "sizeof" to make the corresponding size
> determination a bit safer according to the Linux coding style convention.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

[toc] | [prev] | [next] | [standalone]


#1627207 — [PATCH 7/8] clk: nomadik: Use seq_puts() in nomadik_src_clk_show()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-20 10:40 +0200
Subject[PATCH 7/8] clk: nomadik: Use seq_puts() in nomadik_src_clk_show()
Message-ID<tyfN9-6Do-33@gated-at.bofh.it>
In reply to#1627196
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 20 Apr 2017 09:45:04 +0200

A string which did not contain a data format specification should be put
into a sequence. Thus use the corresponding function "seq_puts".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/clk/clk-nomadik.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/clk-nomadik.c b/drivers/clk/clk-nomadik.c
index 71677eb12565..8d57ab8d6ed8 100644
--- a/drivers/clk/clk-nomadik.c
+++ b/drivers/clk/clk-nomadik.c
@@ -467,7 +467,7 @@ static int nomadik_src_clk_show(struct seq_file *s, void *what)
 	u32 src_pckensr0 = readl(src_base + SRC_PCKENSR0);
 	u32 src_pckensr1 = readl(src_base + SRC_PCKENSR1);
 
-	seq_printf(s, "Clock:      Boot:   Now:    Request: ASKED:\n");
+	seq_puts(s, "Clock:      Boot:   Now:    Request: ASKED:\n");
 	for (i = 0; i < ARRAY_SIZE(src_clk_names); i++) {
 		u32 pcksrb = (i < 0x20) ? src_pcksr0_boot : src_pcksr1_boot;
 		u32 pcksr = (i < 0x20) ? src_pcksr0 : src_pcksr1;
-- 
2.12.2

[toc] | [prev] | [next] | [standalone]


#1628744 — Re: [PATCH 7/8] clk: nomadik: Use seq_puts() in nomadik_src_clk_show()

FromStephen Boyd <sboyd@codeaurora.org>
Date2017-04-22 04:50 +0200
SubjectRe: [PATCH 7/8] clk: nomadik: Use seq_puts() in nomadik_src_clk_show()
Message-ID<tyThw-5w6-7@gated-at.bofh.it>
In reply to#1627207
On 04/20, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 20 Apr 2017 09:45:04 +0200
> 
> A string which did not contain a data format specification should be put
> into a sequence. Thus use the corresponding function "seq_puts".
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web