* [PATCH 0/2] PowerPC-PS3: Adjustments for three function implementations
@ 2017-10-17 18:54 SF Markus Elfring
2017-10-17 18:55 ` [PATCH 1/2] powerpc-ps3: Delete an error message for a failed memory allocation in update_flash_db() SF Markus Elfring
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-10-17 18:54 UTC (permalink / raw)
To: linuxppc-dev, Benjamin Herrenschmidt, Geoff Levand,
Michael Ellerman, Paul Mackerras
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 17 Oct 2017 20:22:44 +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 update_flash_db()
Improve a size determination in two functions
arch/powerpc/platforms/ps3/mm.c | 6 ++----
arch/powerpc/platforms/ps3/os-area.c | 4 +---
2 files changed, 3 insertions(+), 7 deletions(-)
--
2.14.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] powerpc-ps3: Delete an error message for a failed memory allocation in update_flash_db()
2017-10-17 18:54 [PATCH 0/2] PowerPC-PS3: Adjustments for three function implementations SF Markus Elfring
@ 2017-10-17 18:55 ` SF Markus Elfring
2017-10-17 18:56 ` [PATCH 2/2] powerpc-ps3: Improve a size determination in two functions SF Markus Elfring
2017-10-18 19:32 ` [PATCH 0/2] PowerPC-PS3: Adjustments for three function implementations Geoff Levand
2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-10-17 18:55 UTC (permalink / raw)
To: linuxppc-dev, Benjamin Herrenschmidt, Geoff Levand,
Michael Ellerman, Paul Mackerras
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 17 Oct 2017 20:00:31 +0200
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>
---
arch/powerpc/platforms/ps3/os-area.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c
index 3db53e8aff92..f2a8875e25d1 100644
--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -625,10 +625,8 @@ static int update_flash_db(void)
/* Read in header and db from flash. */
header = kmalloc(buf_len, GFP_KERNEL);
- if (!header) {
- pr_debug("%s: kmalloc failed\n", __func__);
+ if (!header)
return -ENOMEM;
- }
count = os_area_flash_read(header, buf_len, 0);
if (count < 0) {
--
2.14.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] powerpc-ps3: Improve a size determination in two functions
2017-10-17 18:54 [PATCH 0/2] PowerPC-PS3: Adjustments for three function implementations SF Markus Elfring
2017-10-17 18:55 ` [PATCH 1/2] powerpc-ps3: Delete an error message for a failed memory allocation in update_flash_db() SF Markus Elfring
@ 2017-10-17 18:56 ` SF Markus Elfring
2017-10-18 19:32 ` [PATCH 0/2] PowerPC-PS3: Adjustments for three function implementations Geoff Levand
2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-10-17 18:56 UTC (permalink / raw)
To: linuxppc-dev, Benjamin Herrenschmidt, Geoff Levand,
Michael Ellerman, Paul Mackerras
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 17 Oct 2017 20:15:17 +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/platforms/ps3/mm.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index b0f34663b1ae..257de451e324 100644
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -524,8 +524,7 @@ static int dma_sb_map_pages(struct ps3_dma_region *r, unsigned long phys_addr,
int result;
struct dma_chunk *c;
- c = kzalloc(sizeof(struct dma_chunk), GFP_ATOMIC);
-
+ c = kzalloc(sizeof(*c), GFP_ATOMIC);
if (!c) {
result = -ENOMEM;
goto fail_alloc;
@@ -570,8 +569,7 @@ static int dma_ioc0_map_pages(struct ps3_dma_region *r, unsigned long phys_addr,
DBG(KERN_ERR "%s: phy=%#lx, lpar%#lx, len=%#lx\n", __func__,
phys_addr, ps3_mm_phys_to_lpar(phys_addr), len);
- c = kzalloc(sizeof(struct dma_chunk), GFP_ATOMIC);
-
+ c = kzalloc(sizeof(*c), GFP_ATOMIC);
if (!c) {
result = -ENOMEM;
goto fail_alloc;
--
2.14.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] PowerPC-PS3: Adjustments for three function implementations
2017-10-17 18:54 [PATCH 0/2] PowerPC-PS3: Adjustments for three function implementations SF Markus Elfring
2017-10-17 18:55 ` [PATCH 1/2] powerpc-ps3: Delete an error message for a failed memory allocation in update_flash_db() SF Markus Elfring
2017-10-17 18:56 ` [PATCH 2/2] powerpc-ps3: Improve a size determination in two functions SF Markus Elfring
@ 2017-10-18 19:32 ` Geoff Levand
2 siblings, 0 replies; 4+ messages in thread
From: Geoff Levand @ 2017-10-18 19:32 UTC (permalink / raw)
To: SF Markus Elfring, linuxppc-dev, Benjamin Herrenschmidt,
Michael Ellerman, Paul Mackerras
Cc: LKML, kernel-janitors
On 10/17/2017 11:54 AM, SF Markus Elfring wrote:
> Markus Elfring (2):
> Delete an error message for a failed memory allocation in update_flash_db()
> Improve a size determination in two functions
For consistency, please use 'powerpc/ps3' not 'powerpc-ps3' as
the commit log subject prefix. Also, please try to keep the
commit log subject to 50 characters or less.
-Geoff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-18 19:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-17 18:54 [PATCH 0/2] PowerPC-PS3: Adjustments for three function implementations SF Markus Elfring
2017-10-17 18:55 ` [PATCH 1/2] powerpc-ps3: Delete an error message for a failed memory allocation in update_flash_db() SF Markus Elfring
2017-10-17 18:56 ` [PATCH 2/2] powerpc-ps3: Improve a size determination in two functions SF Markus Elfring
2017-10-18 19:32 ` [PATCH 0/2] PowerPC-PS3: Adjustments for three function implementations Geoff Levand
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).