diff mbox series

[U-Boot,24/45] tpm: Tidy up logging in tpm-common.c

Message ID 20181001182249.129565-25-sjg@chromium.org
State Accepted
Commit 34a5e8a2f155589e6274fbeef4be0aacf5244a27
Delegated to: Simon Glass
Headers show
Series Various fixes and improvements | expand

Commit Message

Simon Glass Oct. 1, 2018, 6:22 p.m. UTC
At present this file uses logging but it should use the new macros. Update
it and add a log message for an error.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 lib/tpm-common.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Simon Glass Oct. 9, 2018, 11:55 p.m. UTC | #1
At present this file uses logging but it should use the new macros. Update
it and add a log message for an error.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 lib/tpm-common.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Applied to u-boot-dm
diff mbox series

Patch

diff --git a/lib/tpm-common.c b/lib/tpm-common.c
index 43b530865a0..a440639cec3 100644
--- a/lib/tpm-common.c
+++ b/lib/tpm-common.c
@@ -4,6 +4,8 @@ 
  * Coypright (c) 2013 Guntermann & Drunck GmbH
  */
 
+#define LOG_CATEGORY UCLASS_TPM
+
 #include <common.h>
 #include <dm.h>
 #include <asm/unaligned.h>
@@ -110,6 +112,8 @@  int unpack_byte_string(const u8 *str, size_t size, const char *format, ...)
 
 		if (offset + length > size) {
 			va_end(args);
+			log_err("Failed to read: size=%d, offset=%x, len=%x\n",
+				size, offset, length);
 			return -1;
 		}
 
@@ -176,10 +180,10 @@  u32 tpm_sendrecv_command(const void *command, void *response, size_t *size_ptr)
 
 	ret = tpm_return_code(response);
 
-	log(LOGC_NONE, LOGL_DEBUG, "TPM response [ret:%d]: ", ret);
+	log_debug("TPM response [ret:%d]: ", ret);
 	for (i = 0; i < response_length; i++)
-		log(LOGC_NONE, LOGL_DEBUG, "%02x ", ((u8 *)response)[i]);
-	log(LOGC_NONE, LOGL_DEBUG, "\n");
+		log_debug("%02x ", ((u8 *)response)[i]);
+	log_debug("\n");
 
 	return ret;
 }