[PATCH 1/6] PNP: Delete an error message for a failed memory allocation in pnp_alloc()

From: SF Markus Elfring
Date: Mon May 15 2017 - 15:12:41 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 15 May 2017 19:35:29 +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@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/pnp/core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c
index b54620e53830..27945a2d9c4e 100644
--- a/drivers/pnp/core.c
+++ b/drivers/pnp/core.c
@@ -35,10 +35,8 @@ void *pnp_alloc(long size)
void *result;

result = kzalloc(size, GFP_KERNEL);
- if (!result) {
- printk(KERN_ERR "pnp: Out of Memory\n");
+ if (!result)
return NULL;
- }
return result;
}

--
2.13.0