sh-clk: Adjustments for two function implementations
Subsystems (2)
cover sh-clk: Adjustments for two function implementations
From: Markus Elfring <[email protected]>
Date: Tue, 16 May 2017 19:24:56 +0200
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Improve a size determination in sh_clk_fsidiv_register() Delete an error message for a failed memory allocation in two functions
drivers/sh/clk/cpg.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
Signature · 1 line
2.13.0
PATCH 1/2 sh-clk: Improve a size determination in sh_clk_fsidiv_register()
From: Markus Elfring <[email protected]>
Date: Tue, 16 May 2017 18:42:22 +0200
Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention.
--- drivers/sh/clk/cpg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/sh/clk/cpg.c +1 -2
@@ -470,6 +470,5 @@ int __init sh_clk_fsidiv_register(struct clk *clks, int nr)int i;for (i =0 ; i < nr; i++) { - - map =kzalloc (sizeof (struct clk_mapping ),GFP_KERNEL ); + map =kzalloc (sizeof (*map),GFP_KERNEL );if (!map) {
Signature · 1 line
2.13.0
PATCH 2/2 sh-clk: Delete an error message for a failed memory allocation in two functions
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Tue, 16 May 2017 19:05:36 +0200
Omit an extra message for a memory allocation failure in these functions.
This issue was detected by using the Coccinelle software.
--- drivers/sh/clk/cpg.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/sh/clk/cpg.c +2 -6
@@ -253,7 +253,5 @@ static int __init sh_clk_div_register_ops(struct clk *clks, int nr, -if (!freq_table) { -pr_err ("%s: unable to alloc memory\n" , __func__); +if (!freq_table)return -ENOMEM ; - }for (k =0 ; !ret && (k < nr); k++) { clkp = clks + k;
@@ -474,7 +472,5 @@ int __init sh_clk_fsidiv_register(struct clk *clks, int nr) -if (!map) { -pr_err ("%s: unable to alloc memory\n" , __func__); +if (!map)return -ENOMEM ; - }/* clks[i].enable_reg came from SH_CLK_FSIDIV() */ map->phys = (phys_addr_t )clks[i].enable_reg;
Signature · 1 line
2.13.0