tpm: simplify code by using %*phN specifier
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 9 Jul 2014 12:34:41 +0000 (15:34 +0300)
committerPeter Huewe <peterhuewe@gmx.de>
Tue, 29 Jul 2014 21:10:56 +0000 (23:10 +0200)
Instead of looping by ourselves we may use %*phN specifier to dump a small
buffer.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
[ PHuewe: removed now unused variable i ]
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
drivers/char/tpm/tpm_eventlog.c

index 59f7cb28260b4f4c23af010f7615befdd6ed7d23..3a56a131586c824f97e2cc2310c496a91378fd3d 100644 (file)
@@ -235,7 +235,6 @@ static int tpm_bios_measurements_release(struct inode *inode,
 static int tpm_ascii_bios_measurements_show(struct seq_file *m, void *v)
 {
        int len = 0;
-       int i;
        char *eventname;
        struct tcpa_event *event = v;
        unsigned char *event_entry =
@@ -251,8 +250,7 @@ static int tpm_ascii_bios_measurements_show(struct seq_file *m, void *v)
        seq_printf(m, "%2d ", event->pcr_index);
 
        /* 2nd: SHA1 */
-       for (i = 0; i < 20; i++)
-               seq_printf(m, "%02x", event->pcr_value[i]);
+       seq_printf(m, "%20phN", event->pcr_value);
 
        /* 3rd: event type identifier */
        seq_printf(m, " %02x", event->event_type);