[PATCH] S390-DASD: Delete an error message for a failed memory allocation in two functions

From: SF Markus Elfring
Date: Tue May 16 2017 - 09:36:51 EST


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