Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1639000

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

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 1/3] s390/dasd: Adjust buffer output in dasd_hosts_print()
Date 2017-05-10 20:10 +0200
Message-ID <tFEdI-40t-23@gated-at.bofh.it> (permalink)
References <tFEdH-40t-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
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@users.sourceforge.net>
---
 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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] S390-DASD: Fine-tuning for some function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-10 20:10 +0200
  [PATCH 1/3] s390/dasd: Adjust buffer output in dasd_hosts_print() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-10 20:10 +0200
    Re: [PATCH 1/3] s390/dasd: Adjust buffer output in dasd_hosts_print() Dan Carpenter <dan.carpenter@oracle.com> - 2017-05-10 21:40 +0200
    Re: [PATCH 1/3] s390/dasd: Adjust buffer output in dasd_hosts_print() kbuild test robot <lkp@intel.com> - 2017-05-11 00:40 +0200

csiph-web