CoreSight-ETB10: Adjustments for three function implementations
cover CoreSight-ETB10: Adjustments for three function implementations
From: Markus Elfring <[email protected]>
Date: Fri, 12 May 2017 20:46:54 +0200
Three update suggestions were taken into account
from static source code analysis.
Markus Elfring (3):
Delete an error message for a failed memory allocation in etb_probe() Fix a typo in a comment line
Improve a size determination in etb_alloc_buffer()
drivers/hwtracing/coresight/coresight-etb10.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
Signature · 1 line
2.12.3
PATCH 1/3 coresight: etb10: Delete an error message for a failed memory allocation in etb_probe()
From: Markus Elfring <[email protected]>
Date: Fri, 12 May 2017 20:23:43 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
--- drivers/hwtracing/coresight/coresight-etb10.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/hwtracing/coresight/coresight-etb10.c +1 -4
@@ -675,11 +675,8 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) drvdata->buf =devm_kzalloc (dev, drvdata->buffer_depth *4 ,GFP_KERNEL ); -if (!drvdata->buf) { -dev_err (dev,"Failed to allocate %u bytes for buffer data\n" , - drvdata->buffer_depth *4 ); +if (!drvdata->buf)return -ENOMEM ; - } desc.type =CORESIGHT_DEV_TYPE_SINK ; desc.subtype.sink_subtype =CORESIGHT_DEV_SUBTYPE_SINK_BUFFER ;
Signature · 1 line
2.12.3
Re: [PATCH 1/3] coresight: etb10: Delete an error message for a failed memory allocation in etb_probe()
Quoted 20 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 12 May 2017 20:23:43 +0200Omit 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/hwtracing/coresight/coresight-etb10.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/hwtracing/coresight/coresight-etb10.c +0
-0@@ -675,11 +675,8 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) drvdata->buf = devm_kzalloc(dev,
drivers/hwtracing/coresight/coresight-etb10.c static int etb_probe(struct amba_device *adev, const struct amba_id *id) · line 682
Quoted 10 lines
drivers/hwtracing/coresight/coresight-etb10.c +1
-4drvdata->buffer_depth * 4, GFP_KERNEL); -if (!drvdata->buf) { -dev_err (dev,"Failed to allocate %u bytes for buffer data\n" , - drvdata->buffer_depth *4 ); +if (!drvdata->buf)return -ENOMEM ; - } desc.type =CORESIGHT_DEV_TYPE_SINK ; desc.subtype.sink_subtype =CORESIGHT_DEV_SUBTYPE_SINK_BUFFER ;
Applied - thanks.
Quoted 3 lines
--
2.12.3
PATCH 2/3 coresight: etb10: Fix a typo in a comment line
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Fri, 12 May 2017 20:30:42 +0200
Delete a character in this description for a condition check.
--- drivers/hwtracing/coresight/coresight-etb10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight-etb10.c +1 -1
@@ -375,7 +375,7 @@ static void etb_update_buffer(struct coresight_device *csdev,/* * Entries should be aligned to the frame size. If they are not -* go back to the last alignement point to give decoding tools a +* go back to the last alignment point to give decoding tools a * chance to fix things. */ if (write_ptr %ETB_FRAME_SIZE_WORDS ) {
Signature · 1 line
2.12.3
Re: [PATCH 2/3] coresight: etb10: Fix a typo in a comment line
Quoted 15 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 12 May 2017 20:30:42 +0200Delete a character in this description for a condition check.
Signed-off-by Markus Elfring <[email protected]>--- drivers/hwtracing/coresight/coresight-etb10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/hwtracing/coresight/coresight-etb10.c +0
-0
drivers/hwtracing/coresight/coresight-etb10.c static void etb_update_buffer(struct coresight_device *csdev, · line 381
Quoted 8 lines
drivers/hwtracing/coresight/coresight-etb10.c +1
-1@@ -375,7 +375,7 @@ static void etb_update_buffer(struct coresight_device *csdev,/* * Entries should be aligned to the frame size. If they are not -* go back to the last alignement point to give decoding tools a +* go back to the last alignment point to give decoding tools a * chance to fix things. */ if (write_ptr %ETB_FRAME_SIZE_WORDS ) {
Applied - thanks.
Quoted 3 lines
--
2.12.3
PATCH 3/3 coresight: etb10: Improve a size determination in etb_alloc_buffer()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Fri, 12 May 2017 20:36:03 +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.
--- drivers/hwtracing/coresight/coresight-etb10.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/hwtracing/coresight/coresight-etb10.c +1 -2
@@ -278,8 +278,7 @@ static void *etb_alloc_buffer(struct coresight_device *csdev, int cpu,if (cpu =-1 ) cpu =smp_processor_id (); node =cpu_to_node (cpu); - - buf =kzalloc_node (sizeof (struct cs_buffers ),GFP_KERNEL , node); + buf =kzalloc_node (sizeof (*buf),GFP_KERNEL , node);if (!buf)return NULL ;
Signature · 1 line
2.12.3
Re: [PATCH 3/3] coresight: etb10: Improve a size determination in etb_alloc_buffer()
Quoted 17 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 12 May 2017 20:36:03 +0200Replace 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.
Signed-off-by Markus Elfring <[email protected]>--- drivers/hwtracing/coresight/coresight-etb10.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/hwtracing/coresight/coresight-etb10.c +0
-0
drivers/hwtracing/coresight/coresight-etb10.c static void *etb_alloc_buffer(struct coresight_device *csdev, int cpu, · line 281
Quoted 6 lines
drivers/hwtracing/coresight/coresight-etb10.c +1
-2@@ -278,8 +278,7 @@ static void *etb_alloc_buffer(struct coresight_device *csdev, int cpu,if (cpu =-1 ) cpu =smp_processor_id (); node =cpu_to_node (cpu); - - buf =kzalloc_node (sizeof (struct cs_buffers ),GFP_KERNEL , node); + buf =kzalloc_node (sizeof (*buf),GFP_KERNEL , node);
I'm fine with this change but if it's going to happen, it has to be in all the coresight drivers and not just this one - please respin with all instances fixed. One patch per driver would be much appreciated.
Thanks,
Mathieu
Quoted 11 lines
drivers/hwtracing/coresight/coresight-etb10.c +0
-1if (!buf)return NULL ; --2.12.3
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 3/3] coresight: etb10: Improve a size determination in etb_alloc_buffer()
Quoted 4 lines
Quoted 4 lines
+++
b/drivers/hwtracing/coresight/coresight-etb10.cdrivers/hwtracing/coresight/coresight-etb10.c +0
-0@@ -278,8 +278,7 @@ static void *etb_alloc_buffer(struct coresight_device *csdev, int cpu,if (cpu =-1 ) cpu =smp_processor_id ();
Quoted 8 lines
drivers/hwtracing/coresight/coresight-etb10.c static void *etb_alloc_buffer(struct coresight_device *csdev, int cpu, · line 281
Quoted 4 lines
drivers/hwtracing/coresight/coresight-etb10.c +1
-2node =cpu_to_node (cpu); - - buf =kzalloc_node (sizeof (struct cs_buffers ),GFP_KERNEL , node); + buf =kzalloc_node (sizeof (*buf),GFP_KERNEL , node);I'm fine with this change but if it's going to happen, it has to be in all the coresight drivers and not just this one - please respin with all instances fixed. One patch per driver would be much appreciated.
Do you imagine that any more modules are affected in a similar way for this software area?
How do you think about other update suggestions from my selection which are waiting for a corresponding review?
Regards,
Markus