irqchip/irq-gic: Adjustments for three function implementations
cover irqchip/irq-gic: Adjustments for three function implementations
From: Markus Elfring <[email protected]>
Date: Thu, 18 Jan 2018 17:17:34 +0100
A few update suggestions were taken into account
from static source code analysis.
Markus Elfring (5):
Delete an error message for a failed memory allocation in gicv2m_init_one() Improve a size determination in gicv2m_init_one()
Mark a of_device_id variable as "const"
Delete an error message for a failed memory allocation in two functions Mark an array of text strings as "const"
drivers/irqchip/irq-gic-v2m.c | 9 +++------ drivers/irqchip/irq-gic-v3-its.c | 10 +++------- 2 files changed, 6 insertions(+), 13 deletions(-)
Signature · 1 line
2.15.1
PATCH 1/5 irqchip/irq-gic-v2m: Delete an error message for a failed memory allocation in gicv2m_init_one()
From: Markus Elfring <[email protected]>
Date: Thu, 18 Jan 2018 15:44:01 +0100
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
--- drivers/irqchip/irq-gic-v2m.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/irqchip/irq-gic-v2m.c +1 -3
@@ -309,10 +309,8 @@ static int __init gicv2m_init_one(struct fwnode_handle *fwnode,struct v2m_data *v2m; v2m =kzalloc (sizeof (struct v2m_data ),GFP_KERNEL ); -if (!v2m) { -pr_err ("Failed to allocate struct v2m_data.\n" ); +if (!v2m)return -ENOMEM ; - }INIT_LIST_HEAD (&v2m->entry); v2m->fwnode = fwnode;
Signature · 1 line
2.15.1
PATCH 2/5 irqchip/irq-gic-v2m: Improve a size determination in gicv2m_init_one()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Thu, 18 Jan 2018 16:07:41 +0100
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.
This issue was detected by using the Coccinelle software.
--- drivers/irqchip/irq-gic-v2m.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/irqchip/irq-gic-v2m.c +1 -2
@@ -306,9 +306,8 @@ static int __init gicv2m_init_one(struct fwnode_handle *fwnode, struct resource *res) {int ret; -struct v2m_data *v2m; +struct v2m_data *v2m =kzalloc (sizeof (*v2m),GFP_KERNEL ); - v2m =kzalloc (sizeof (struct v2m_data ),GFP_KERNEL );if (!v2m)return -ENOMEM ;
Signature · 1 line
2.15.1
PATCH 3/5 irqchip/irq-gic-v2m: Mark a of_device_id variable as "const"
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Thu, 18 Jan 2018 16:33:43 +0100
The script "checkpatch.pl" pointed information out like the following.
WARNING: struct of_device_id should normally be const
Thus fix the affected source code place.
--- drivers/irqchip/irq-gic-v2m.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-v2m.c +1 -1
@@ -380,7 +380,7 @@ static int __init gicv2m_init_one(struct fwnode_handle *fwnode,return ret; } -static struct of_device_id gicv2m_device_id[] = { +static const struct of_device_id gicv2m_device_id[] = { { .compatible ="arm,gic-v2m-frame" , }, {}, };
Signature · 1 line
2.15.1
PATCH 4/5 irqchip/irq-gic-v3-its: Delete an error message for a failed memory allocation in two functions
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Thu, 18 Jan 2018 16:54:16 +0100
Omit an extra message for a memory allocation failure in these functions.
This issue was detected by using the Coccinelle software.
--- drivers/irqchip/irq-gic-v3-its.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/irqchip/irq-gic-v3-its.c +2 -6
@@ -3084,10 +3084,8 @@ static int its_init_vpe_domain(void) entries =roundup_pow_of_two (nr_cpu_ids); vpe_proxy.vpes =kzalloc (sizeof (*vpe_proxy.vpes) * entries,GFP_KERNEL ); -if (!vpe_proxy.vpes) { -pr_err ("ITS: Can't allocate GICv4 proxy device array\n" ); +if (!vpe_proxy.vpes)return -ENOMEM ; - }/* Use the last possible DevID */ devid =GENMASK (its->device_ids -1 ,0 );
@@ -3407,10 +3405,8 @@ static void __init acpi_table_parse_srat_its(void) its_srat_maps =kmalloc (count *sizeof (struct its_srat_map ),GFP_KERNEL ); -if (!its_srat_maps) { -pr_warn ("SRAT: Failed to allocate memory for its_srat_maps!\n" ); +if (!its_srat_maps)return ; - } acpi_table_parse_entries(ACPI_SIG_SRAT, sizeof(struct acpi_table_srat),
Signature · 1 line
2.15.1
PATCH 5/5 irqchip/irq-gic-v3-its: Mark an array of text strings as "const"
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Thu, 18 Jan 2018 17:05:34 +0100
The script "checkpatch.pl" pointed information out like the following.
WARNING: static const char * array should probably be static const char * const
Thus fix the affected source code place.
--- drivers/irqchip/irq-gic-v3-its.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-v3-its.c +1 -1
@@ -1551,7 +1551,7 @@ static int __init its_alloc_lpi_tables(void)return its_lpi_init (lpi_id_bits); } -static const char *its_base_type_string[] = { +static const char *const its_base_type_string[] = { [GITS_BASER_TYPE_DEVICE ] ="Devices" , [GITS_BASER_TYPE_VCPU ] ="Virtual CPUs" , [GITS_BASER_TYPE_RESERVED3 ] ="Reserved (3)" ,
Signature · 1 line
2.15.1