From: SF Markus Elfring <hidden> Date: 2016-08-29 11:01:26
From: Markus Elfring <redacted>
Date: Mon, 29 Aug 2016 11:44:22 +0200
Some update suggestions were taken into account
from static source code analysis.
Markus Elfring (5):
Use kmalloc_array() in mpic_init()
Use kmalloc_array() in ppc4xx_setup_msi_irqs()
Use kmalloc_array() in hsta_msi_probe()
Rename jump labels in hsta_msi_probe()
Move three assignments in hsta_msi_probe()
arch/powerpc/sysdev/mpic.c | 5 +++--
arch/powerpc/sysdev/ppc4xx_hsta_msi.c | 26 +++++++++++++-------------
arch/powerpc/sysdev/ppc4xx_msi.c | 4 +++-
3 files changed, 19 insertions(+), 16 deletions(-)
--
2.9.3
From: SF Markus Elfring <hidden> Date: 2016-08-29 11:08:25
From: Markus Elfring <redacted>
Date: Mon, 29 Aug 2016 11:00:11 +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 "kmalloc_array".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <redacted>
---
arch/powerpc/sysdev/mpic.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
From: SF Markus Elfring <hidden> Date: 2016-08-29 11:09:42
From: Markus Elfring <redacted>
Date: Mon, 29 Aug 2016 11:11:24 +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 "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data type by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <redacted>
---
arch/powerpc/sysdev/ppc4xx_msi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
From: SF Markus Elfring <hidden> Date: 2016-08-29 11:11:05
From: Markus Elfring <redacted>
Date: Mon, 29 Aug 2016 11:20:39 +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 "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data type by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <redacted>
---
arch/powerpc/sysdev/ppc4xx_hsta_msi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
From: SF Markus Elfring <hidden> Date: 2016-08-29 11:12:47
From: Markus Elfring <redacted>
Date: Mon, 29 Aug 2016 11:22:19 +0200
Adjust jump labels according to the current Linux coding style convention.
Signed-off-by: Markus Elfring <redacted>
---
arch/powerpc/sysdev/ppc4xx_hsta_msi.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
@@ -154,14 +154,14 @@ static int hsta_msi_probe(struct platform_device *pdev)ret=msi_bitmap_alloc(&ppc4xx_hsta_msi.bmp,irq_count,dev->of_node);if(ret)-gotoout;+gotounmap_io;ppc4xx_hsta_msi.irq_map=kmalloc_array(irq_count,sizeof(*ppc4xx_hsta_msi.irq_map),GFP_KERNEL);if(!ppc4xx_hsta_msi.irq_map){ret=-ENOMEM;-gotoout1;+gotofree_bitmap;}/* Setup a mapping from irq offsets to hardware irq numbers */
@@ -171,7 +171,7 @@ static int hsta_msi_probe(struct platform_device *pdev)if(ppc4xx_hsta_msi.irq_map[irq]==NO_IRQ){dev_err(dev,"Unable to map IRQ\n");ret=-EINVAL;-gotoout2;+gotofree_irq_map;}}
@@ -180,14 +180,11 @@ static int hsta_msi_probe(struct platform_device *pdev)phb->controller_ops.teardown_msi_irqs=hsta_teardown_msi_irqs;}return0;--out2:+free_irq_map:kfree(ppc4xx_hsta_msi.irq_map);--out1:+free_bitmap:msi_bitmap_free(&ppc4xx_hsta_msi.bmp);--out:+unmap_io:iounmap(ppc4xx_hsta_msi.data);returnret;}
From: SF Markus Elfring <hidden> Date: 2016-08-29 11:13:36
From: Markus Elfring <redacted>
Date: Mon, 29 Aug 2016 11:30:48 +0200
Move the assignments for three data structure members to the end
so that they will only be performed if the desired resource allocations
succeeded by this function.
Signed-off-by: Markus Elfring <redacted>
---
arch/powerpc/sysdev/ppc4xx_hsta_msi.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)