From 3f3907b50eb321ce882113e1d9875d37b2f84f42 Mon Sep 17 00:00:00 2001 From: Nan Li Date: Fri, 25 Oct 2019 19:20:48 +0800 Subject: [PATCH] emmc: optimize sdio tuning print [1/1] PD#SWPL-15797 Problem: commit a5c3731f5d46f4104876b8c7ddf84f7a1b6ba071 this patch has err, the print buf will be out of bounds. Solution: Reposition the pointer before each loop. Verify: tl1 Change-Id: I8f44269c375147c5290af9c6d84fd5d85be271f0 Signed-off-by: Nan Li --- drivers/amlogic/mmc/aml_sd_emmc_v3.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/amlogic/mmc/aml_sd_emmc_v3.c b/drivers/amlogic/mmc/aml_sd_emmc_v3.c index 1965f12..5d2b656 100644 --- a/drivers/amlogic/mmc/aml_sd_emmc_v3.c +++ b/drivers/amlogic/mmc/aml_sd_emmc_v3.c @@ -1735,7 +1735,7 @@ static int _aml_sd_emmc_execute_tuning(struct mmc_host *mmc, u32 opcode, u32 old_dly, d1_dly, dly; unsigned long fixed_adj_map[1]; bool all_flag = false; - u8 *adj_print = host->adj_win; + u8 *adj_print = NULL; u32 len = 0; if ((host->mem->start == host->data->port_b_base) @@ -1756,6 +1756,8 @@ tunning: curr_win_start = -1; curr_win_size = 0; + len = 0; + adj_print = host->adj_win; memset(adj_print, 0, sizeof(u8) * ADJ_WIN_PRINT_MAXLEN); len += sprintf(adj_print + len, "%s: adj_win: < ", pdata->pinname); spin_lock_irqsave(&host->mrq_lock, flags); -- 2.7.4