lkml.org 
[lkml]   [2017]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 3/3] s390/dasd: Adjust six checks for null pointers
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 10 May 2017 19:29:17 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written …

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/s390/block/dasd_eckd.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index e78601d97a67..d02f3bbbd552 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -1080,7 +1080,7 @@ static int dasd_eckd_read_conf(struct dasd_device *device)
"error %d", rc);
return rc;
}
- if (conf_data == NULL) {
+ if (!conf_data) {
DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s",
"No configuration data "
"retrieved");
@@ -2049,7 +2049,7 @@ static int dasd_eckd_end_analysis(struct dasd_block *block)
"Track 0 has no records following the VTOC\n");
}

- if (count_area != NULL && count_area->kl == 0) {
+ if (count_area && count_area->kl == 0) {
/* we found notthing violating our disk layout */
if (dasd_check_blocksize(count_area->dl) == 0)
block->bp_block = count_area->dl;
@@ -2649,10 +2649,10 @@ static int dasd_eckd_format_process_data(struct dasd_device *base,
old_start = fdata->start_unit;
old_stop = fdata->stop_unit;

- if (!tpm && fmt_buffer != NULL) {
+ if (!tpm && fmt_buffer) {
/* Command Mode / Format Check */
format_step = 1;
- } else if (tpm && fmt_buffer != NULL) {
+ } else if (tpm && fmt_buffer) {
/* Transport Mode / Format Check */
format_step = DASD_CQR_MAX_CCW / rpt;
} else {
@@ -4681,7 +4681,7 @@ static void dasd_eckd_dump_sense_ccw(struct dasd_device *device,
int len, sl, sct;

page = (char *) get_zeroed_page(GFP_ATOMIC);
- if (page == NULL) {
+ if (!page) {
DBF_DEV_EVENT(DBF_WARNING, device, "%s",
"No memory to dump sense data\n");
return;
@@ -4785,7 +4785,7 @@ static void dasd_eckd_dump_sense_tcw(struct dasd_device *device,
u8 *sense, *rcq;

page = (char *) get_zeroed_page(GFP_ATOMIC);
- if (page == NULL) {
+ if (!page) {
DBF_DEV_EVENT(DBF_WARNING, device, " %s",
"No memory to dump sense data");
return;
--
2.12.3
\
 
 \ /
  Last update: 2017-05-10 21:22    [W:0.075 / U:49.628 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site