From cda6a5f57667247a4165b878d14e30e2246fba4a Mon Sep 17 00:00:00 2001 From: Jingjing Wu Date: Sun, 6 Sep 2015 15:11:18 +0800 Subject: [PATCH] i40e/base: reformat AQ debug output Replace sprintf with i40e_debug. Pad the line out with zeros to get to 16 bytes. Signed-off-by: Jingjing Wu Acked-by: Helin Zhang Tested-by: Huilong Xu --- drivers/net/i40e/base/i40e_common.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index ba7bc67f4f..455f98d91c 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -344,16 +344,20 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc, buf[i+4], buf[i+5], buf[i+6], buf[i+7], buf[i+8], buf[i+9], buf[i+10], buf[i+11], buf[i+12], buf[i+13], buf[i+14], buf[i+15]); - /* write whatever's left over without overrunning the buffer */ + /* the most we could have left is 16 bytes, pad with zeros */ if (i < len) { - char d_buf[80]; - int j = 0; + char d_buf[16]; + int j; memset(d_buf, 0, sizeof(d_buf)); - j += sprintf(d_buf, "\t0x%04X ", i); - while (i < len) - j += sprintf(&d_buf[j], " %02X", buf[i++]); - i40e_debug(hw, mask, "%s\n", d_buf); + for (j = 0; i < len; j++, i++) + d_buf[j] = buf[i]; + i40e_debug(hw, mask, + "\t0x%04X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", + i, d_buf[0], d_buf[1], d_buf[2], d_buf[3], + d_buf[4], d_buf[5], d_buf[6], d_buf[7], + d_buf[8], d_buf[9], d_buf[10], d_buf[11], + d_buf[12], d_buf[13], d_buf[14], d_buf[15]); } } } -- 2.20.1