From: SF Markus Elfring <elfring@users.sourceforge.net>
To: kernel-janitors@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/4] char/snsc: Delete three error messages for a failed memory allocation
Date: Mon, 16 Oct 2017 15:05:24 +0000 [thread overview]
Message-ID: <c65e3957-dd85-4a33-8e05-5d498aa7b6b2@users.sourceforge.net> (raw)
In-Reply-To: <cbedda27-97e7-7b11-b888-39e09f7deaa1@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 16 Oct 2017 16:24:09 +0200
Omit extra messages 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/char/snsc.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c
index f551a625686a..eefc306033ab 100644
--- a/drivers/char/snsc.c
+++ b/drivers/char/snsc.c
@@ -80,11 +80,8 @@ scdrv_open(struct inode *inode, struct file *file)
/* allocate memory for subchannel data */
sd = kzalloc(sizeof (struct subch_data_s), GFP_KERNEL);
- if (sd = NULL) {
- printk("%s: couldn't allocate subchannel data\n",
- __func__);
+ if (!sd)
return -ENOMEM;
- }
/* initialize subch_data_s fields */
sd->sd_nasid = scd->scd_nasid;
@@ -410,20 +407,13 @@ scdrv_init(void)
/* allocate sysctl device data */
scd = kzalloc(sizeof (struct sysctl_data_s),
GFP_KERNEL);
- if (!scd) {
- printk("%s: failed to allocate device info"
- "for %s/%s\n", __func__,
- SYSCTL_BASENAME, devname);
+ if (!scd)
continue;
- }
/* initialize sysctl device data fields */
scd->scd_nasid = cnodeid_to_nasid(cnode);
salbuf = kmalloc(SCDRV_BUFSZ, GFP_KERNEL);
if (!salbuf) {
- printk("%s: failed to allocate driver buffer"
- "(%s%s)\n", __func__,
- SYSCTL_BASENAME, devname);
kfree(scd);
continue;
}
--
2.14.2
next prev parent reply other threads:[~2017-10-16 15:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-16 15:02 [PATCH 0/4] char-SNSC: Adjustments for six function implementations SF Markus Elfring
2017-10-16 15:04 ` [PATCH 1/4] char/snsc: Adjust one function call together with a variable assignment SF Markus Elfring
2017-10-16 15:05 ` SF Markus Elfring [this message]
2017-10-16 15:06 ` [PATCH 3/4] char/snsc: Improve a size determination in two functions SF Markus Elfring
2017-10-16 15:07 ` [PATCH 4/4] char/snsc: Delete unnecessary braces in five functions SF Markus Elfring
2017-10-17 8:49 ` Dan Carpenter
2017-10-17 9:11 ` 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=c65e3957-dd85-4a33-8e05-5d498aa7b6b2@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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