emmc: optimize sdio tuning print [1/1]
authorNan Li <nan.li@amlogic.com>
Fri, 25 Oct 2019 11:20:48 +0000 (19:20 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 28 Oct 2019 02:42:22 +0000 (19:42 -0700)
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 <nan.li@amlogic.com>
drivers/amlogic/mmc/aml_sd_emmc_v3.c

index 1965f12..5d2b656 100644 (file)
@@ -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);