ARM: OMAP2+: Adjustments for seven function implementations
Subsystems (4)
cover ARM: OMAP2+: Adjustments for seven function implementations
From: Markus Elfring <[email protected]>
Date: Sat, 3 Jun 2017 20:12:34 +0200
Some update suggestions were taken into account
from static source code analysis.
Markus Elfring (9):
Delete an error message for a failed memory allocation in omap_mcspi_init() Delete an error message for a failed memory allocation in two functions Delete an unnecessary variable initialisation in omap_init_mcbsp() Improve a size determination in omap_init_mcbsp()
Delete an error message for a failed memory allocation in omap_init_mcbsp() Improve a size determination in sr_dev_init()
Use kcalloc() in sr_set_nvalues()
SmartReflex: Delete an error message for a failed memory allocation in two functions Delete an error message for a failed memory allocation in omap_timer_init()
arch/arm/mach-omap2/devices.c | 4 +--- arch/arm/mach-omap2/hsmmc.c | 5 +---- arch/arm/mach-omap2/mcbsp.c | 8 +++----- arch/arm/mach-omap2/sr_device.c | 15 ++++----------- arch/arm/mach-omap2/timer.c | 4 +--- 5 files changed, 10 insertions(+), 26 deletions(-)
Signature · 1 line
2.13.0
PATCH 1/9 ARM: OMAP2+: Delete an error message for a failed memory allocation in omap_mcspi_init()
From: Markus Elfring <[email protected]>
Date: Sat, 3 Jun 2017 16:45:12 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
--- arch/arm/mach-omap2/devices.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm/mach-omap2/devices.c +1 -3
@@ -82,7 +82,5 @@ static int __init omap_mcspi_init(struct omap_hwmod *oh, void *unused) -if (!pdata) { -pr_err ("Memory allocation for McSPI device failed\n" ); +if (!pdata)return -ENOMEM ; - } pdata->num_cs = mcspi_attrib->num_chipselect;switch (oh->class->rev) {
Signature · 1 line
2.13.0
PATCH 2/9 ARM: OMAP2+: Delete an error message for a failed memory allocation in two functions
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sat, 3 Jun 2017 17:24:27 +0200
Omit an extra message for a memory allocation failure in these functions.
This issue was detected by using the Coccinelle software.
--- arch/arm/mach-omap2/hsmmc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/arm/mach-omap2/hsmmc.c +1 -4
@@ -155,5 +155,4 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,if (!hc_name) { -pr_err ("Cannot allocate memory for controller slot name\n" );kfree (hc_name);return -ENOMEM ; }
@@ -318,7 +317,5 @@ static void __init omap_hsmmc_init_one(struct omap2_hsmmc_info *hsmmcinfo, -if (!mmc_data) { -pr_err ("Cannot allocate memory for mmc device!\n" ); +if (!mmc_data)return ; - } res =omap_hsmmc_pdata_init (hsmmcinfo, mmc_data);if (res <0 )
Signature · 1 line
2.13.0
PATCH 3/9 ARM: OMAP2+: McBSP: Delete an unnecessary variable initialisation in omap_init_mcbsp()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sat, 3 Jun 2017 17:54:19 +0200
The local variable "pdata" is reassigned by a statement at the beginning. Thus omit the explicit initialisation.
--- arch/arm/mach-omap2/mcbsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/mcbsp.c +1 -1
@@ -59,5 +59,5 @@ static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)int id, count =1 ;char *name ="omap-mcbsp" ;struct omap_hwmod *oh_device[2 ]; -struct omap_mcbsp_platform_data *pdata =NULL ; +struct omap_mcbsp_platform_data *pdata;struct platform_device *pdev;
Signature · 1 line
2.13.0
PATCH 4/9 ARM: OMAP2+: McBSP: Improve a size determination in omap_init_mcbsp()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sat, 3 Jun 2017 17:56:57 +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.
--- arch/arm/mach-omap2/mcbsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/mcbsp.c +1 -1
@@ -66,3 +66,3 @@ static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused) - pdata =kzalloc (sizeof (struct omap_mcbsp_platform_data ),GFP_KERNEL ); + pdata =kzalloc (sizeof (*pdata),GFP_KERNEL );if (!pdata) {
Signature · 1 line
2.13.0
PATCH 5/9 ARM: OMAP2+: McBSP: Delete an error message for a failed memory allocation in omap_init_mcbsp()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sat, 3 Jun 2017 18:03:25 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
--- arch/arm/mach-omap2/mcbsp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm/mach-omap2/mcbsp.c +1 -3
@@ -68,7 +68,5 @@ static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused) -if (!pdata) { -pr_err ("%s: No memory for mcbsp\n" , __func__); +if (!pdata)return -ENOMEM ; - } pdata->reg_step =4 ;if (oh->class->rev <MCBSP_CONFIG_TYPE2 ) {
Signature · 1 line
2.13.0
PATCH 6/9 ARM: OMAP2+: Improve a size determination in sr_dev_init()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sat, 3 Jun 2017 19:02:24 +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.
--- arch/arm/mach-omap2/sr_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/sr_device.c +1 -1
@@ -102,5 +102,5 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user)char *name ="smartreflex" ;static int i; - sr_data =kzalloc (sizeof (struct omap_sr_data ),GFP_KERNEL ); + sr_data =kzalloc (sizeof (*sr_data),GFP_KERNEL );if (!sr_data) {
Signature · 1 line
2.13.0
PATCH 7/9 ARM: OMAP2+: Use kcalloc() in sr_set_nvalues()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sat, 3 Jun 2017 19:09:07 +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 structure by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention.
--- arch/arm/mach-omap2/sr_device.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm/mach-omap2/sr_device.c +1 -3
@@ -44,7 +44,5 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data,while (volt_data[count].volt_nominal) count++; - nvalue_table =kzalloc (sizeof (struct omap_sr_nvalue_table )*count, -GFP_KERNEL ); - + nvalue_table =kcalloc (count,sizeof (*nvalue_table),GFP_KERNEL );if (!nvalue_table) {
Signature · 1 line
2.13.0
PATCH 8/9 ARM: OMAP2+: SmartReflex: Delete an error message for a failed memory allocation in two functions
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sat, 3 Jun 2017 19:16:27 +0200
Omit an extra message for a memory allocation failure in these functions.
This issue was detected by using the Coccinelle software.
--- arch/arm/mach-omap2/sr_device.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
arch/arm/mach-omap2/sr_device.c +2 -7
@@ -48,7 +48,5 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data, -if (!nvalue_table) { -pr_err ("OMAP: SmartReflex: cannot allocate memory for n-value table\n" ); +if (!nvalue_table)return ; - }for (i =0 , j =0 ; i < count; i++) {u32 v;
@@ -104,8 +102,5 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user) -if (!sr_data) { -pr_err ("%s: Unable to allocate memory for %s sr_data\n" , - __func__, oh->name); +if (!sr_data)return -ENOMEM ; - } sr_dev_attr = (struct omap_smartreflex_dev_attr *)oh->dev_attr;if (!sr_dev_attr || !sr_dev_attr->sensor_voltdm_name) {
Signature · 1 line
2.13.0
PATCH 9/9 ARM: OMAP2+: Delete an error message for a failed memory allocation in omap_timer_init()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sat, 3 Jun 2017 19:23:59 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
--- arch/arm/mach-omap2/timer.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm/mach-omap2/timer.c +1 -3
@@ -693,7 +693,5 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused) -if (!pdata) { -pr_err ("%s: No memory for [%s]\n" , __func__, oh->name); +if (!pdata)return -ENOMEM ; - }/* * Extract the IDs from name field in hwmod database
Signature · 1 line
2.13.0
Tony Lindgren
maintainerQuoted 6 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Sat, 3 Jun 2017 20:12:34 +0200Some update suggestions were taken into account
from static source code analysis.
Quoted 10 lines
Markus Elfring (9):
Delete an error message for a failed memory allocation inomap_mcspi_init()Delete an error message for a failed memory allocation in two functions Delete an unnecessary variable initialisation inomap_init_mcbsp()Improve a size determination inomap_init_mcbsp()
Delete an error message for a failed memory allocation inomap_init_mcbsp()Improve a size determination insr_dev_init()
Usekcalloc()insr_set_nvalues()
SmartReflex: Delete an error message for a failed memory allocation in two functions Delete an error message for a failed memory allocation inomap_timer_init()
Thanks for the patches. Many of these are no longer needed as I've now dropped more of the legacy boot code as everything for mach-omap2 is booting in device tree mode.
So I'm applying the following ones into omap-for-v4.13/soc.
Regards,
Tony
8< -------
ARM: OMAP2+: SmartReflex: Delete an error message for a failed memory allocation in two functions
ARM: OMAP2+: Use kcalloc() in sr_set_nvalues()
ARM: OMAP2+: Improve a size determination in sr_dev_init()
ARM: OMAP2+: Delete an error message for a failed memory allocation in two functions