[PATCH 2/3] pcmcia/cis: Delete an error message for a failed memory allocation in two functions

From: SF Markus Elfring
Date: Thu Dec 28 2017 - 16:47:18 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 28 Dec 2017 22:20:51 +0100

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/pcmcia/pcmcia_cis.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/pcmcia/pcmcia_cis.c b/drivers/pcmcia/pcmcia_cis.c
index 1c05d74e850d..ffcd014b7bc1 100644
--- a/drivers/pcmcia/pcmcia_cis.c
+++ b/drivers/pcmcia/pcmcia_cis.c
@@ -43,10 +43,9 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function,
int ret;

buf = kmalloc(256, GFP_KERNEL);
- if (buf == NULL) {
- dev_warn(&s->dev, "no memory to read tuple\n");
+ if (!buf)
return -ENOMEM;
- }
+
tuple.DesiredTuple = code;
tuple.Attributes = 0;
if (function == BIND_FN_ALL)
@@ -93,10 +92,8 @@ int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function,
int ret;

buf = kzalloc(256, GFP_KERNEL);
- if (buf == NULL) {
- dev_warn(&s->dev, "no memory to read tuple\n");
+ if (!buf)
return -ENOMEM;
- }

tuple.TupleData = buf;
tuple.TupleDataMax = 255;
--
2.15.1