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

From: SF Markus Elfring
Date: Wed May 10 2017 - 14:01:30 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
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")
Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/s390/block/dasd_eckd.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 122456e4db89..b3709d3cba54 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -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 */
--
2.12.3