linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-s390@vger.kernel.org,
	"Heiko Carstens" <heiko.carstens@de.ibm.com>,
	"Jan Höppner" <hoeppner@linux.vnet.ibm.com>,
	"Martin Schwidefsky" <schwidefsky@de.ibm.com>,
	"Stefan Haberland" <sth@linux.vnet.ibm.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org, Wolfram Sang <wsa@the-dreams.de>
Subject: [PATCH] S390-DASD: Delete an error message for a failed memory allocation in two functions
Date: Tue, 16 May 2017 15:36:34 +0200	[thread overview]
Message-ID: <5708cda3-991c-e05c-85c4-5b2199395bb4@users.sourceforge.net> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 16 May 2017 15:30:44 +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@users.sourceforge.net>
---
 drivers/s390/block/dasd_eckd.c | 7 ++-----
 drivers/s390/block/dasd_fba.c  | 7 ++-----
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 122456e4db89..99c73decae49 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -1721,12 +1721,9 @@ dasd_eckd_check_characteristics(struct dasd_device *device)
 	}
 	if (!private) {
 		private = kzalloc(sizeof(*private), GFP_KERNEL | GFP_DMA);
-		if (!private) {
-			dev_warn(&device->cdev->dev,
-				 "Allocating memory for private DASD data "
-				 "failed\n");
+		if (!private)
 			return -ENOMEM;
-		}
+
 		device->private = private;
 	} else {
 		memset(private, 0, sizeof(*private));
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
index 462cab5d4302..2b2f9b0da5c2 100644
--- a/drivers/s390/block/dasd_fba.c
+++ b/drivers/s390/block/dasd_fba.c
@@ -132,12 +132,9 @@ dasd_fba_check_characteristics(struct dasd_device *device)
 
 	if (!private) {
 		private = kzalloc(sizeof(*private), GFP_KERNEL | GFP_DMA);
-		if (!private) {
-			dev_warn(&device->cdev->dev,
-				 "Allocating memory for private DASD "
-				 "data failed\n");
+		if (!private)
 			return -ENOMEM;
-		}
+
 		device->private = private;
 	} else {
 		memset(private, 0, sizeof(*private));
-- 
2.13.0

                 reply	other threads:[~2017-05-16 13:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=5708cda3-991c-e05c-85c4-5b2199395bb4@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hoeppner@linux.vnet.ibm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=sth@linux.vnet.ibm.com \
    --cc=wsa@the-dreams.de \
    /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;
as well as URLs for NNTP newsgroup(s).