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


Groups > linux.kernel > #1625184 > unrolled thread

[PATCH 0/6] clk-Hisilicon: Fine-tuning for some function implementations

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-04-18 11:40 +0200
Last post2017-04-19 20:40 +0200
Articles 11 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/6] clk-Hisilicon: Fine-tuning for some function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-18 11:40 +0200
    [PATCH 6/6] clk: hi3620: Fix a typo in one variable name SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-18 11:50 +0200
      Re: [PATCH 6/6] clk: hi3620: Fix a typo in one variable name Stephen Boyd <sboyd@codeaurora.org> - 2017-04-19 20:40 +0200
    [PATCH 4/6] clk: hi3620: Use kcalloc() in hi3620_mmc_clk_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-18 11:50 +0200
      Re: [PATCH 4/6] clk: hi3620: Use kcalloc() in hi3620_mmc_clk_init() Stephen Boyd <sboyd@codeaurora.org> - 2017-04-19 20:40 +0200
    [PATCH 2/6] clk: hisilicon: Delete error messages for failed memory  allocations in hisi_clk_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-18 11:50 +0200
      Re: [PATCH 2/6] clk: hisilicon: Delete error messages for failed  memory allocations in hisi_clk_init() Stephen Boyd <sboyd@codeaurora.org> - 2017-04-19 20:40 +0200
    [PATCH 5/6] clk: hi3620: Delete error messages for a failed memory  allocation in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-18 11:50 +0200
      Re: [PATCH 5/6] clk: hi3620: Delete error messages for a failed  memory allocation in two functions Stephen Boyd <sboyd@codeaurora.org> - 2017-04-19 20:40 +0200
    [PATCH 3/6] clk: hisilicon: Use devm_kmalloc_array() in  hisi_clk_alloc() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-18 11:50 +0200
      Re: [PATCH 3/6] clk: hisilicon: Use devm_kmalloc_array() in  hisi_clk_alloc() Stephen Boyd <sboyd@codeaurora.org> - 2017-04-19 20:40 +0200

#1625184 — [PATCH 0/6] clk-Hisilicon: Fine-tuning for some function implementations

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-18 11:40 +0200
Subject[PATCH 0/6] clk-Hisilicon: Fine-tuning for some function implementations
Message-ID<txxM6-4vX-21@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 18 Apr 2017 11:27:32 +0200

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

Markus Elfring (6):
  Use kcalloc() in hisi_clk_init()
  Delete error messages for failed memory allocations in hisi_clk_init()
  Use devm_kmalloc_array() in hisi_clk_alloc()
  Use kcalloc() in hi3620_mmc_clk_init()
  Delete error messages for a failed memory allocation in two functions
  Fix a typo in one variable name

 drivers/clk/hisilicon/clk-hi3620.c | 16 ++++++----------
 drivers/clk/hisilicon/clk.c        | 18 ++++++++----------
 2 files changed, 14 insertions(+), 20 deletions(-)

-- 
2.12.2

[toc] | [next] | [standalone]


#1625186 — [PATCH 6/6] clk: hi3620: Fix a typo in one variable name

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-18 11:50 +0200
Subject[PATCH 6/6] clk: hi3620: Fix a typo in one variable name
Message-ID<txxVL-4zJ-3@gated-at.bofh.it>
In reply to#1625184
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 18 Apr 2017 11:15:56 +0200

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

CHECK: 'seperated' may be misspelled - perhaps 'separated'?

Thus rename the affected variable.

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

diff --git a/drivers/clk/hisilicon/clk-hi3620.c b/drivers/clk/hisilicon/clk-hi3620.c
index 33a713ac8fe6..fa0fba653898 100644
--- a/drivers/clk/hisilicon/clk-hi3620.c
+++ b/drivers/clk/hisilicon/clk-hi3620.c
@@ -144,7 +144,7 @@ static struct hisi_divider_clock hi3620_div_clks[] __initdata = {
 	{ HI3620_MMC3_DIV,     "mmc3_div",   "mmc3_mux",  0, 0x140, 5, 4, CLK_DIVIDER_HIWORD_MASK, NULL, },
 };
 
-static struct hisi_gate_clock hi3620_seperated_gate_clks[] __initdata = {
+static struct hisi_gate_clock hi3620_separated_gate_clks[] __initdata = {
 	{ HI3620_TIMERCLK01,   "timerclk01",   "timer_rclk01", CLK_SET_RATE_PARENT, 0x20, 0, 0, },
 	{ HI3620_TIMER_RCLK01, "timer_rclk01", "rclk_tcxo",    CLK_SET_RATE_PARENT, 0x20, 1, 0, },
 	{ HI3620_TIMERCLK23,   "timerclk23",   "timer_rclk23", CLK_SET_RATE_PARENT, 0x20, 2, 0, },
@@ -224,8 +224,8 @@ static void __init hi3620_clk_init(struct device_node *np)
 			      clk_data);
 	hisi_clk_register_divider(hi3620_div_clks, ARRAY_SIZE(hi3620_div_clks),
 				  clk_data);
-	hisi_clk_register_gate_sep(hi3620_seperated_gate_clks,
-				   ARRAY_SIZE(hi3620_seperated_gate_clks),
+	hisi_clk_register_gate_sep(hi3620_separated_gate_clks,
+				   ARRAY_SIZE(hi3620_separated_gate_clks),
 				   clk_data);
 }
 CLK_OF_DECLARE(hi3620_clk, "hisilicon,hi3620-clock", hi3620_clk_init);
-- 
2.12.2

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


#1626692 — Re: [PATCH 6/6] clk: hi3620: Fix a typo in one variable name

FromStephen Boyd <sboyd@codeaurora.org>
Date2017-04-19 20:40 +0200
SubjectRe: [PATCH 6/6] clk: hi3620: Fix a typo in one variable name
Message-ID<ty2Gf-6Qx-57@gated-at.bofh.it>
In reply to#1625186
On 04/18, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 18 Apr 2017 11:15:56 +0200
> 
> The script "checkpatch.pl" pointed information out like the following.
> 
> CHECK: 'seperated' may be misspelled - perhaps 'separated'?
> 
> Thus rename the affected variable.
> 
> 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]


#1625187 — [PATCH 4/6] clk: hi3620: Use kcalloc() in hi3620_mmc_clk_init()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-18 11:50 +0200
Subject[PATCH 4/6] clk: hi3620: Use kcalloc() in hi3620_mmc_clk_init()
Message-ID<txxVL-4zJ-5@gated-at.bofh.it>
In reply to#1625184
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 18 Apr 2017 10:30:04 +0200

* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus use the corresponding function "kcalloc".

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data type by a pointer dereference
  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/hisilicon/clk-hi3620.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/hisilicon/clk-hi3620.c b/drivers/clk/hisilicon/clk-hi3620.c
index d04a104ce1b4..f6dd971c9d3c 100644
--- a/drivers/clk/hisilicon/clk-hi3620.c
+++ b/drivers/clk/hisilicon/clk-hi3620.c
@@ -482,7 +482,7 @@ static void __init hi3620_mmc_clk_init(struct device_node *node)
 	if (WARN_ON(!clk_data))
 		return;
 
-	clk_data->clks = kzalloc(sizeof(struct clk *) * num, GFP_KERNEL);
+	clk_data->clks = kcalloc(num, sizeof(*clk_data->clks), GFP_KERNEL);
 	if (!clk_data->clks) {
 		pr_err("%s: fail to allocate mmc clk\n", __func__);
 		return;
-- 
2.12.2

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


#1626701 — Re: [PATCH 4/6] clk: hi3620: Use kcalloc() in hi3620_mmc_clk_init()

FromStephen Boyd <sboyd@codeaurora.org>
Date2017-04-19 20:40 +0200
SubjectRe: [PATCH 4/6] clk: hi3620: Use kcalloc() in hi3620_mmc_clk_init()
Message-ID<ty2Gg-6Qx-75@gated-at.bofh.it>
In reply to#1625187
On 04/18, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 18 Apr 2017 10:30:04 +0200
> 
> * A multiplication for the size determination of a memory allocation
>   indicated that an array data structure should be processed.
>   Thus use the corresponding function "kcalloc".
> 
>   This issue was detected by using the Coccinelle software.
> 
> * Replace the specification of a data type by a pointer dereference
>   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]


#1625188 — [PATCH 2/6] clk: hisilicon: Delete error messages for failed memory allocations in hisi_clk_init()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-18 11:50 +0200
Subject[PATCH 2/6] clk: hisilicon: Delete error messages for failed memory allocations in hisi_clk_init()
Message-ID<txxVL-4zJ-11@gated-at.bofh.it>
In reply to#1625184
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 18 Apr 2017 10:12:32 +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/hisilicon/clk.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/hisilicon/clk.c b/drivers/clk/hisilicon/clk.c
index 9268e80b7566..eca4c66e316c 100644
--- a/drivers/clk/hisilicon/clk.c
+++ b/drivers/clk/hisilicon/clk.c
@@ -80,16 +80,14 @@ struct hisi_clock_data *hisi_clk_init(struct device_node *np,
 	}
 
 	clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL);
-	if (!clk_data) {
-		pr_err("%s: could not allocate clock data\n", __func__);
+	if (!clk_data)
 		goto err;
-	}
+
 	clk_data->base = base;
 	clk_table = kcalloc(nr_clks, sizeof(*clk_table), GFP_KERNEL);
-	if (!clk_table) {
-		pr_err("%s: could not allocate clock lookup table\n", __func__);
+	if (!clk_table)
 		goto err_data;
-	}
+
 	clk_data->clk_data.clks = clk_table;
 	clk_data->clk_data.clk_num = nr_clks;
 	of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data->clk_data);
-- 
2.12.2

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


#1626700 — Re: [PATCH 2/6] clk: hisilicon: Delete error messages for failed memory allocations in hisi_clk_init()

FromStephen Boyd <sboyd@codeaurora.org>
Date2017-04-19 20:40 +0200
SubjectRe: [PATCH 2/6] clk: hisilicon: Delete error messages for failed memory allocations in hisi_clk_init()
Message-ID<ty2Gg-6Qx-69@gated-at.bofh.it>
In reply to#1625188
On 04/18, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 18 Apr 2017 10:12:32 +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>
> ---

Applied to clk-next

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

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


#1625190 — [PATCH 5/6] clk: hi3620: Delete error messages for a failed memory allocation in two functions

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-18 11:50 +0200
Subject[PATCH 5/6] clk: hi3620: Delete error messages for a failed memory allocation in two functions
Message-ID<txxVL-4zJ-9@gated-at.bofh.it>
In reply to#1625184
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 18 Apr 2017 10:50:53 +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/hisilicon/clk-hi3620.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/hisilicon/clk-hi3620.c b/drivers/clk/hisilicon/clk-hi3620.c
index f6dd971c9d3c..33a713ac8fe6 100644
--- a/drivers/clk/hisilicon/clk-hi3620.c
+++ b/drivers/clk/hisilicon/clk-hi3620.c
@@ -430,10 +430,8 @@ static struct clk *hisi_register_clk_mmc(struct hisi_mmc_clock *mmc_clk,
 	struct clk_init_data init;
 
 	mclk = kzalloc(sizeof(*mclk), GFP_KERNEL);
-	if (!mclk) {
-		pr_err("%s: fail to allocate mmc clk\n", __func__);
+	if (!mclk)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	init.name = mmc_clk->name;
 	init.ops = &clk_mmc_ops;
@@ -483,10 +481,8 @@ static void __init hi3620_mmc_clk_init(struct device_node *node)
 		return;
 
 	clk_data->clks = kcalloc(num, sizeof(*clk_data->clks), GFP_KERNEL);
-	if (!clk_data->clks) {
-		pr_err("%s: fail to allocate mmc clk\n", __func__);
+	if (!clk_data->clks)
 		return;
-	}
 
 	for (i = 0; i < num; i++) {
 		struct hisi_mmc_clock *mmc_clk = &hi3620_mmc_clks[i];
-- 
2.12.2

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


#1626686 — Re: [PATCH 5/6] clk: hi3620: Delete error messages for a failed memory allocation in two functions

FromStephen Boyd <sboyd@codeaurora.org>
Date2017-04-19 20:40 +0200
SubjectRe: [PATCH 5/6] clk: hi3620: Delete error messages for a failed memory allocation in two functions
Message-ID<ty2Gd-6Qx-7@gated-at.bofh.it>
In reply to#1625190
On 04/18, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 18 Apr 2017 10:50:53 +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>
> ---

Applied to clk-next

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

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


#1625192 — [PATCH 3/6] clk: hisilicon: Use devm_kmalloc_array() in hisi_clk_alloc()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-18 11:50 +0200
Subject[PATCH 3/6] clk: hisilicon: Use devm_kmalloc_array() in hisi_clk_alloc()
Message-ID<txxVL-4zJ-15@gated-at.bofh.it>
In reply to#1625184
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 18 Apr 2017 10:15:19 +0200

* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus use the corresponding function "devm_kmalloc_array".

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data type by a pointer dereference
  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/hisilicon/clk.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/hisilicon/clk.c b/drivers/clk/hisilicon/clk.c
index eca4c66e316c..b73c1dfae7f1 100644
--- a/drivers/clk/hisilicon/clk.c
+++ b/drivers/clk/hisilicon/clk.c
@@ -54,8 +54,9 @@ struct hisi_clock_data *hisi_clk_alloc(struct platform_device *pdev,
 	if (!clk_data->base)
 		return NULL;
 
-	clk_table = devm_kmalloc(&pdev->dev, sizeof(struct clk *) * nr_clks,
-				GFP_KERNEL);
+	clk_table = devm_kmalloc_array(&pdev->dev, nr_clks,
+				       sizeof(*clk_table),
+				       GFP_KERNEL);
 	if (!clk_table)
 		return NULL;
 
-- 
2.12.2

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


#1626698 — Re: [PATCH 3/6] clk: hisilicon: Use devm_kmalloc_array() in hisi_clk_alloc()

FromStephen Boyd <sboyd@codeaurora.org>
Date2017-04-19 20:40 +0200
SubjectRe: [PATCH 3/6] clk: hisilicon: Use devm_kmalloc_array() in hisi_clk_alloc()
Message-ID<ty2Gf-6Qx-53@gated-at.bofh.it>
In reply to#1625192
On 04/18, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 18 Apr 2017 10:15:19 +0200
> 
> * A multiplication for the size determination of a memory allocation
>   indicated that an array data structure should be processed.
>   Thus use the corresponding function "devm_kmalloc_array".
> 
>   This issue was detected by using the Coccinelle software.
> 
> * Replace the specification of a data type by a pointer dereference
>   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] | [standalone]


Back to top | Article view | linux.kernel


csiph-web