mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/5] irqchip/irq-gic: Adjustments for three function implementations
@ 2018-01-18 16:21 SF Markus Elfring
  2018-01-18 16:22 ` [PATCH 1/5] irqchip/irq-gic-v2m: Delete an error message for a failed memory allocation in gicv2m_init_one() SF Markus Elfring
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: SF Markus Elfring @ 2018-01-18 16:21 UTC (permalink / raw)
  To: kernel-janitors, Jason Cooper, Marc Zyngier, Thomas Gleixner; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/5] irqchip/irq-gic-v2m: Delete an error message for a failed memory allocation in gicv2m_init_one()
  2018-01-18 16:21 [PATCH 0/5] irqchip/irq-gic: Adjustments for three function implementations SF Markus Elfring
@ 2018-01-18 16:22 ` SF Markus Elfring
  2018-01-18 16:24 ` [PATCH 2/5] irqchip/irq-gic-v2m: Improve a size determination " SF Markus Elfring
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2018-01-18 16:22 UTC (permalink / raw)
  To: kernel-janitors, Jason Cooper, Marc Zyngier, Thomas Gleixner; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/5] irqchip/irq-gic-v2m: Improve a size determination in gicv2m_init_one()
  2018-01-18 16:21 [PATCH 0/5] irqchip/irq-gic: Adjustments for three function implementations SF Markus Elfring
  2018-01-18 16:22 ` [PATCH 1/5] irqchip/irq-gic-v2m: Delete an error message for a failed memory allocation in gicv2m_init_one() SF Markus Elfring
@ 2018-01-18 16:24 ` SF Markus Elfring
  2018-01-18 16:25 ` [PATCH 3/5] irqchip/irq-gic-v2m: Mark a of_device_id variable as "const" SF Markus Elfring
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2018-01-18 16:24 UTC (permalink / raw)
  To: kernel-janitors, Jason Cooper, Marc Zyngier, Thomas Gleixner; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/5] irqchip/irq-gic-v2m: Mark a of_device_id variable as "const"
  2018-01-18 16:21 [PATCH 0/5] irqchip/irq-gic: Adjustments for three function implementations SF Markus Elfring
  2018-01-18 16:22 ` [PATCH 1/5] irqchip/irq-gic-v2m: Delete an error message for a failed memory allocation in gicv2m_init_one() SF Markus Elfring
  2018-01-18 16:24 ` [PATCH 2/5] irqchip/irq-gic-v2m: Improve a size determination " SF Markus Elfring
@ 2018-01-18 16:25 ` SF Markus Elfring
  2018-01-18 16:26 ` [PATCH 4/5] irqchip/irq-gic-v3-its: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
  2018-01-18 16:27 ` [PATCH 5/5] irqchip/irq-gic-v3-its: Mark an array of text strings as "const" SF Markus Elfring
  4 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2018-01-18 16:25 UTC (permalink / raw)
  To: kernel-janitors, Jason Cooper, Marc Zyngier, Thomas Gleixner; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/5] irqchip/irq-gic-v3-its: Delete an error message for a failed memory allocation in two functions
  2018-01-18 16:21 [PATCH 0/5] irqchip/irq-gic: Adjustments for three function implementations SF Markus Elfring
                   ` (2 preceding siblings ...)
  2018-01-18 16:25 ` [PATCH 3/5] irqchip/irq-gic-v2m: Mark a of_device_id variable as "const" SF Markus Elfring
@ 2018-01-18 16:26 ` SF Markus Elfring
  2018-01-18 16:27 ` [PATCH 5/5] irqchip/irq-gic-v3-its: Mark an array of text strings as "const" SF Markus Elfring
  4 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2018-01-18 16:26 UTC (permalink / raw)
  To: kernel-janitors, Jason Cooper, Marc Zyngier, Thomas Gleixner; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 5/5] irqchip/irq-gic-v3-its: Mark an array of text strings as "const"
  2018-01-18 16:21 [PATCH 0/5] irqchip/irq-gic: Adjustments for three function implementations SF Markus Elfring
                   ` (3 preceding siblings ...)
  2018-01-18 16:26 ` [PATCH 4/5] irqchip/irq-gic-v3-its: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
@ 2018-01-18 16:27 ` SF Markus Elfring
  4 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2018-01-18 16:27 UTC (permalink / raw)
  To: kernel-janitors, Jason Cooper, Marc Zyngier, Thomas Gleixner; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-01-18 16:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-18 16:21 [PATCH 0/5] irqchip/irq-gic: Adjustments for three function implementations SF Markus Elfring
2018-01-18 16:22 ` [PATCH 1/5] irqchip/irq-gic-v2m: Delete an error message for a failed memory allocation in gicv2m_init_one() SF Markus Elfring
2018-01-18 16:24 ` [PATCH 2/5] irqchip/irq-gic-v2m: Improve a size determination " SF Markus Elfring
2018-01-18 16:25 ` [PATCH 3/5] irqchip/irq-gic-v2m: Mark a of_device_id variable as "const" SF Markus Elfring
2018-01-18 16:26 ` [PATCH 4/5] irqchip/irq-gic-v3-its: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
2018-01-18 16:27 ` [PATCH 5/5] irqchip/irq-gic-v3-its: Mark an array of text strings as "const" SF Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome