* [PATCH 0/2] PowerPC-Cell OProfile: Adjustments for three function implementations
@ 2017-10-05 15:40 SF Markus Elfring
2017-10-05 15:41 ` [PATCH 1/2] powerpc/oprofile/cell: Delete an error message for a failed memory allocation in three functions SF Markus Elfring
2017-10-05 15:42 ` [PATCH 2/2] powerpc/oprofile/cell: Improve a size determination in two functions SF Markus Elfring
0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-10-05 15:40 UTC (permalink / raw)
To: linuxppc-dev, oprofile-list, Al Viro, Benjamin Herrenschmidt,
Michael Ellerman, Paul Mackerras, Robert Richter
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 5 Oct 2017 17:32:10 +0200
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Delete an error message for a failed memory allocation in three functions
Improve a size determination in two functions
arch/powerpc/oprofile/cell/spu_task_sync.c | 10 +---------
arch/powerpc/oprofile/cell/vma_map.c | 6 ++----
2 files changed, 3 insertions(+), 13 deletions(-)
--
2.14.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] powerpc/oprofile/cell: Delete an error message for a failed memory allocation in three functions
2017-10-05 15:40 [PATCH 0/2] PowerPC-Cell OProfile: Adjustments for three function implementations SF Markus Elfring
@ 2017-10-05 15:41 ` SF Markus Elfring
2017-10-05 15:42 ` [PATCH 2/2] powerpc/oprofile/cell: Improve a size determination in two functions SF Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-10-05 15:41 UTC (permalink / raw)
To: linuxppc-dev, oprofile-list, Al Viro, Benjamin Herrenschmidt,
Michael Ellerman, Paul Mackerras, Robert Richter
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 5 Oct 2017 17:10:11 +0200
Omit extra messages 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>
---
arch/powerpc/oprofile/cell/spu_task_sync.c | 8 --------
arch/powerpc/oprofile/cell/vma_map.c | 2 --
2 files changed, 10 deletions(-)
diff --git a/arch/powerpc/oprofile/cell/spu_task_sync.c b/arch/powerpc/oprofile/cell/spu_task_sync.c
index 44d67b167e0b..f1dd732b2998 100644
--- a/arch/powerpc/oprofile/cell/spu_task_sync.c
+++ b/arch/powerpc/oprofile/cell/spu_task_sync.c
@@ -210,9 +210,6 @@ prepare_cached_spu_info(struct spu *spu, unsigned long objectId)
*/
info = kzalloc(sizeof(struct cached_info), GFP_KERNEL);
if (!info) {
- printk(KERN_ERR "SPU_PROF: "
- "%s, line %d: create vma_map failed\n",
- __func__, __LINE__);
retval = -ENOMEM;
goto err_alloc;
}
@@ -481,11 +478,6 @@ static int oprofile_spu_buff_create(void)
GFP_KERNEL);
if (!spu_buff[spu].buff) {
- printk(KERN_ERR "SPU_PROF: "
- "%s, line %d: oprofile_spu_buff_create "
- "failed to allocate spu buffer %d.\n",
- __func__, __LINE__, spu);
-
/* release the spu buffers that have been allocated */
while (spu >= 0) {
kfree(spu_buff[spu].buff);
diff --git a/arch/powerpc/oprofile/cell/vma_map.c b/arch/powerpc/oprofile/cell/vma_map.c
index c579b16845da..a115d9ede053 100644
--- a/arch/powerpc/oprofile/cell/vma_map.c
+++ b/arch/powerpc/oprofile/cell/vma_map.c
@@ -72,8 +72,6 @@ vma_map_add(struct vma_to_fileoffset_map *map, unsigned int vma,
struct vma_to_fileoffset_map *new =
kzalloc(sizeof(struct vma_to_fileoffset_map), GFP_KERNEL);
if (!new) {
- printk(KERN_ERR "SPU_PROF: %s, line %d: malloc failed\n",
- __func__, __LINE__);
vma_map_free(map);
return NULL;
}
--
2.14.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] powerpc/oprofile/cell: Improve a size determination in two functions
2017-10-05 15:40 [PATCH 0/2] PowerPC-Cell OProfile: Adjustments for three function implementations SF Markus Elfring
2017-10-05 15:41 ` [PATCH 1/2] powerpc/oprofile/cell: Delete an error message for a failed memory allocation in three functions SF Markus Elfring
@ 2017-10-05 15:42 ` SF Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2017-10-05 15:42 UTC (permalink / raw)
To: linuxppc-dev, oprofile-list, Al Viro, Benjamin Herrenschmidt,
Michael Ellerman, Paul Mackerras, Robert Richter
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 5 Oct 2017 17:18:33 +0200
Replace the specification of data structures by pointer dereferences
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>
---
arch/powerpc/oprofile/cell/spu_task_sync.c | 2 +-
arch/powerpc/oprofile/cell/vma_map.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/oprofile/cell/spu_task_sync.c b/arch/powerpc/oprofile/cell/spu_task_sync.c
index f1dd732b2998..8ab442925296 100644
--- a/arch/powerpc/oprofile/cell/spu_task_sync.c
+++ b/arch/powerpc/oprofile/cell/spu_task_sync.c
@@ -208,7 +208,7 @@ prepare_cached_spu_info(struct spu *spu, unsigned long objectId)
/* Create cached_info and set spu_info[spu->number] to point to it.
* spu->number is a system-wide value, not a per-node value.
*/
- info = kzalloc(sizeof(struct cached_info), GFP_KERNEL);
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info) {
retval = -ENOMEM;
goto err_alloc;
diff --git a/arch/powerpc/oprofile/cell/vma_map.c b/arch/powerpc/oprofile/cell/vma_map.c
index a115d9ede053..03de415a377c 100644
--- a/arch/powerpc/oprofile/cell/vma_map.c
+++ b/arch/powerpc/oprofile/cell/vma_map.c
@@ -69,8 +69,8 @@ vma_map_add(struct vma_to_fileoffset_map *map, unsigned int vma,
unsigned int size, unsigned int offset, unsigned int guard_ptr,
unsigned int guard_val)
{
- struct vma_to_fileoffset_map *new =
- kzalloc(sizeof(struct vma_to_fileoffset_map), GFP_KERNEL);
+ struct vma_to_fileoffset_map *new = kzalloc(sizeof(*new), GFP_KERNEL);
+
if (!new) {
vma_map_free(map);
return NULL;
--
2.14.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-05 15:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-05 15:40 [PATCH 0/2] PowerPC-Cell OProfile: Adjustments for three function implementations SF Markus Elfring
2017-10-05 15:41 ` [PATCH 1/2] powerpc/oprofile/cell: Delete an error message for a failed memory allocation in three functions SF Markus Elfring
2017-10-05 15:42 ` [PATCH 2/2] powerpc/oprofile/cell: Improve a size determination in two functions 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;
as well as URLs for NNTP newsgroup(s).