From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-pcmcia@lists.infradead.org,
Bhumika Goyal <bhumirks@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/3] pcmcia/cis: Delete an error message for a failed memory allocation in two functions
Date: Thu, 28 Dec 2017 22:46:54 +0100 [thread overview]
Message-ID: <c22708e9-bd7f-71fa-d70c-eed78a04de01@users.sourceforge.net> (raw)
In-Reply-To: <4eaa454f-8b57-fe0a-4802-3676bc2f582e@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
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@users.sourceforge.net>
---
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
next prev parent reply other threads:[~2017-12-28 21:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-28 21:44 [PATCH 0/3] PCMCIA-CIS: Adjustments for six function implementations SF Markus Elfring
2017-12-28 21:45 ` [PATCH 1/3] pcmcia/cistpl: Delete error messages for a failed memory allocation in three functions SF Markus Elfring
2017-12-28 21:46 ` SF Markus Elfring [this message]
2017-12-28 21:48 ` [PATCH 3/3] pcmcia/cis: Improve a size determination in pcmcia_loop_config() SF Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c22708e9-bd7f-71fa-d70c-eed78a04de01@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=bhumirks@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pcmcia@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome