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(-)
--
2.15.1
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.
Signed-off-by: Markus Elfring <[email protected]>
---
drivers/irqchip/irq-gic-v2m.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c
index 993a8426a453..b795fefafb12 100644
--- a/drivers/irqchip/irq-gic-v2m.c
+++ b/drivers/irqchip/irq-gic-v2m.c
@@ -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;
--
2.15.1
From: 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.
Signed-off-by: Markus Elfring <[email protected]>
---
drivers/irqchip/irq-gic-v3-its.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 06f025fd5726..100c3125f20e 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -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),
--
2.15.1
From: 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.
Signed-off-by: Markus Elfring <[email protected]>
---
drivers/irqchip/irq-gic-v3-its.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 100c3125f20e..09f0297a1f59 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -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)",
--
2.15.1
From: 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.
Signed-off-by: Markus Elfring <[email protected]>
---
drivers/irqchip/irq-gic-v2m.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c
index b795fefafb12..930261710ba2 100644
--- a/drivers/irqchip/irq-gic-v2m.c
+++ b/drivers/irqchip/irq-gic-v2m.c
@@ -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;
--
2.15.1
From: 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.
Signed-off-by: Markus Elfring <[email protected]>
---
drivers/irqchip/irq-gic-v2m.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c
index 930261710ba2..7482c2b86bb8 100644
--- a/drivers/irqchip/irq-gic-v2m.c
+++ b/drivers/irqchip/irq-gic-v2m.c
@@ -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", },
{},
};
--
2.15.1