* [PATCH] s390: kernel: Delete an error message for a failed memory allocation in cpcmd()
@ 2017-05-25 17:18 SF Markus Elfring
2017-05-25 18:28 ` Paul Gortmaker
0 siblings, 1 reply; 2+ messages in thread
From: SF Markus Elfring @ 2017-05-25 17:18 UTC (permalink / raw)
To: linux-s390, Heiko Carstens, Martin Schwidefsky, Paul Gortmaker
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 25 May 2017 19:09:50 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/s390/kernel/cpcmd.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/s390/kernel/cpcmd.c b/arch/s390/kernel/cpcmd.c
index 9f0e4a2785f7..2f9c97813846 100644
--- a/arch/s390/kernel/cpcmd.c
+++ b/arch/s390/kernel/cpcmd.c
@@ -95,10 +95,9 @@ int cpcmd(const char *cmd, char *response, int rlen, int *response_code)
if ((virt_to_phys(response) != (unsigned long) response) ||
(((unsigned long)response + rlen) >> 31)) {
lowbuf = kmalloc(rlen, GFP_KERNEL | GFP_DMA);
- if (!lowbuf) {
- pr_warn("The cpcmd kernel function failed to allocate a response buffer\n");
+ if (!lowbuf)
return -ENOMEM;
- }
+
spin_lock_irqsave(&cpcmd_lock, flags);
len = __cpcmd(cmd, lowbuf, rlen, response_code);
spin_unlock_irqrestore(&cpcmd_lock, flags);
--
2.13.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] s390: kernel: Delete an error message for a failed memory allocation in cpcmd()
2017-05-25 17:18 [PATCH] s390: kernel: Delete an error message for a failed memory allocation in cpcmd() SF Markus Elfring
@ 2017-05-25 18:28 ` Paul Gortmaker
0 siblings, 0 replies; 2+ messages in thread
From: Paul Gortmaker @ 2017-05-25 18:28 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-s390, Heiko Carstens, Martin Schwidefsky, LKML,
kernel-janitors
[[PATCH] s390: kernel: Delete an error message for a failed memory allocation in cpcmd()] On 25/05/2017 (Thu 19:18) SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 25 May 2017 19:09:50 +0200
>
> Omit an extra message for a memory allocation failure in this function.
>
Since I was Cc'd -- NACK.
Please, please stop sending garbage patches to every maintainer and
project you can find.
P.
--
> This issue was detected by using the Coccinelle software.
>
> Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> arch/s390/kernel/cpcmd.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/s390/kernel/cpcmd.c b/arch/s390/kernel/cpcmd.c
> index 9f0e4a2785f7..2f9c97813846 100644
> --- a/arch/s390/kernel/cpcmd.c
> +++ b/arch/s390/kernel/cpcmd.c
> @@ -95,10 +95,9 @@ int cpcmd(const char *cmd, char *response, int rlen, int *response_code)
> if ((virt_to_phys(response) != (unsigned long) response) ||
> (((unsigned long)response + rlen) >> 31)) {
> lowbuf = kmalloc(rlen, GFP_KERNEL | GFP_DMA);
> - if (!lowbuf) {
> - pr_warn("The cpcmd kernel function failed to allocate a response buffer\n");
> + if (!lowbuf)
> return -ENOMEM;
> - }
> +
> spin_lock_irqsave(&cpcmd_lock, flags);
> len = __cpcmd(cmd, lowbuf, rlen, response_code);
> spin_unlock_irqrestore(&cpcmd_lock, flags);
> --
> 2.13.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-25 18:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-25 17:18 [PATCH] s390: kernel: Delete an error message for a failed memory allocation in cpcmd() SF Markus Elfring
2017-05-25 18:28 ` Paul Gortmaker
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).