Skip to contentSkip to conversation

S390-DASD: Fine-tuning for some function implementations

PATCH In review SF Markus Elfring 4 participants 8 messages May 10, 2017 – Dec 14, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover S390-DASD: Fine-tuning for some function implementations

From: Markus Elfring <[email protected]>
Date: Wed, 10 May 2017 19:43:21 +0200

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
Adjust buffer output in dasd_hosts_print()
Fix typos in two comment lines
Adjust six checks for null pointers

 drivers/s390/block/dasd_eckd.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)
Signature · 1 line
2.12.3
#1 lore raw

PATCH 1/3 s390/dasd: Adjust buffer output in dasd_hosts_print()

From: Markus Elfring <[email protected]>
Date: Wed, 10 May 2017 18:52:28 +0200

* Use a special format string specification for the desired output of the array "pgid" into a sequence.

This issue was detected by using the Coccinelle software.

* Delete the local variable "j" and a call of the function "seq_puts" wich became unnecessary with this refactoring.

Fixes 5a3b7b112884f80ff19b18028fabeb4f9c035518 ("s390/dasd: add query host access to volume support")
---
 drivers/s390/block/dasd_eckd.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/s390/block/dasd_eckd.c +3 -5
index 122456e4db89..b3709d3cba54 100644
@@ -5288,7 +5288,7 @@ static int dasd_hosts_print(struct dasd_device *device, struct seq_file *m)
 	struct dasd_ckd_path_group_entry *entry;
 	struct dasd_ckd_host_information *info;
 	char sysplex[9] = "";
-	int rc, i, j;
+	int rc, i;
 
 	access = kzalloc(sizeof(*access), GFP_NOIO);
 	if (!access) {
@@ -5308,10 +5308,8 @@ static int dasd_hosts_print(struct dasd_device *device, struct seq_file *m)
 		entry = (struct dasd_ckd_path_group_entry *)
 			(info->entry + i * info->entry_size);
 		/* PGID */
-		seq_puts(m, "pgid ");
-		for (j = 0; j < 11; j++)
-			seq_printf(m, "%02x", entry->pgid[j]);
-		seq_putc(m, '\n');
+		seq_printf(m, "pgid %*phN\n",
+			   ARRAY_SIZE(entry->pgid), entry->pgid);
 		/* FLAGS */
 		seq_printf(m, "status_flags %02x\n", entry->status_flags);
 		/* SYSPLEX NAME */
Signature · 1 line
2.12.3
#2 lore raw

Re: [PATCH 1/3] s390/dasd: Adjust buffer output in dasd_hosts_print()

Quoted 6 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 10 May 2017 18:52:28 +0200

* Use a special format string specification for the desired output of the array "pgid" into a sequence.

Quoted 6 lines

This issue was detected by using the Coccinelle software.

* Delete the local variable "j" and a call of the function "seq_puts" wich became unnecessary with this refactoring.

Fixes 5a3b7b112884f80ff19b18028fabeb4f9c035518 ("s390/dasd: add query host access to volume support")

Stop using the fixes tag when you are not fixing bugs.

regards,
dan carpenter

#3 lore raw

Re: [PATCH 1/3] s390/dasd: Adjust buffer output in dasd_hosts_print()

In reply to SF Markus Elfring
reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross…

Hi Markus,

[auto build test WARNING on s390/features]
[also build test WARNING on v4.11 next-20170510]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/SF-Markus-Elfring/S390-DASD-Fine-tuning-for-some-function-implementations/20170511-022121
base:   https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features
config: s390-default_defconfig (attached as .config)
compiler: s390x-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705

reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=s390

All warnings (new ones prefixed by >>):

drivers/s390/block/dasd_eckd.c: In function 'dasd_hosts_print':

>> drivers/s390/block/dasd_eckd.c:5311:24: warning: field width specifier '*' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Wformat=]
      seq_printf(m, "pgid %*phN\n",
                           ^

vim +5311 drivers/s390/block/dasd_eckd.c

5295 DBF_EVENT_DEVID(DBF_WARNING, device->cdev, "%s",
5296 "Could not allocate access buffer");
5297 return -ENOMEM;
5298 }
5299 rc = dasd_eckd_query_host_access(device, access);
5300 if (rc) {
5301 kfree(access);
5302 return rc;
5303 }
5304
5305 info = (struct dasd_ckd_host_information *)
5306 access->host_access_information;
5307 for (i = 0; i < info->entry_count; i++) {
5308 entry = (struct dasd_ckd_path_group_entry *)
5309 (info->entry + i * info->entry_size);
5310 /* PGID */

> 5311			seq_printf(m, "pgid %*phN\n",

5312 ARRAY_SIZE(entry->pgid), entry->pgid);
5313 /* FLAGS */
5314 seq_printf(m, "status_flags %02x\n", entry->status_flags);
5315 /* SYSPLEX NAME */
5316 memcpy(&sysplex, &entry->sysplex_name, sizeof(sysplex) - 1);
5317 EBCASC(sysplex, sizeof(sysplex));
5318 seq_printf(m, "sysplex_name %8s\n", sysplex);
5319 /* SUPPORTED CYLINDER */

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#4 lore raw

PATCH 2/3 s390/dasd: Fix typos in two comment lines

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 10 May 2017 19:19:19 +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.

CHECK: '…' may be misspelled - perhaps '…'?

Thus fix two descriptions.

---
 drivers/s390/block/dasd_eckd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/s390/block/dasd_eckd.c +2 -2
index b3709d3cba54..e78601d97a67 100644
@@ -3863,7 +3863,7 @@ static struct dasd_ccw_req *dasd_raw_build_cp(struct dasd_device *startdev,
 	unsigned int pfx_datasize;
 
 	/*
-	 * raw track access needs to be mutiple of 64k and on 64k boundary
+	 * Raw track access needs to be multiple of 64k and on 64k boundary.
 	 * For read requests we can fix an incorrect alignment by padding
 	 * the request with dummy pages.
 	 */
@@ -4143,7 +4143,7 @@ dasd_eckd_fill_info(struct dasd_device * device,
 
 /*
  * Release device ioctl.
- * Buils a channel programm to releases a prior reserved
+ * Builds a channel program to release a prior reserved
  * (see dasd_eckd_reserve) device.
  */
 static int
Signature · 1 line
2.12.3
#5 lore raw

PATCH 3/3 s390/dasd: Adjust six checks for null pointers

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
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.

---
 drivers/s390/block/dasd_eckd.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/s390/block/dasd_eckd.c +6 -6
index e78601d97a67..d02f3bbbd552 100644
@@ -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;
Signature · 1 line
2.12.3
#6 lore raw
In reply to SF Markus Elfring
Quoted 5 lines

Date: Wed, 10 May 2017 19:43:21 +0200

A few update suggestions were taken into account
from static source code analysis.

Quoted 7 lines

Markus Elfring (3):
Adjust buffer output in dasd_hosts_print()
Fix typos in two comment lines
Adjust six checks for null pointers

 drivers/s390/block/dasd_eckd.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

Are there any chances that such change possibilities (and further adjustments) will be integrated in this software area?

Regards,
Markus

#7 lore raw
Quoted 10 lines · SF Markus Elfring
Quoted 10 lines

Date: Wed, 10 May 2017 19:43:21 +0200

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
Adjust buffer output in dasd_hosts_print()
Fix typos in two comment lines
Adjust six checks for null pointers

Quoted 6 lines
Quoted 2 lines
 drivers/s390/block/dasd_eckd.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

Are there any chances that such change possibilities (and further adjustments) will be integrated in this software area?

No.