[PATCH 2/4] char/snsc: Delete three error messages for a failed memory allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux