]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
scsi: ufs: fix empty check of error history
authorStanley Chu <stanley.chu@mediatek.com>
Sat, 4 Jan 2020 14:26:06 +0000 (22:26 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 16 Jan 2020 02:59:44 +0000 (21:59 -0500)
Currently checking if an error history element is empty or not is by its
"value". In most cases, value is error code.

However this checking is not correct because some errors or events do not
specify any values in error history so values remain as 0, and this will
lead to incorrect empty checking.

Fix it by checking "timestamp" instead of "value" because timestamp will be
always assigned for all history elements

Cc: Alim Akhtar <alim.akhtar@samsung.com>
Cc: Asutosh Das <asutoshd@codeaurora.org>
Cc: Avri Altman <avri.altman@wdc.com>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Bean Huo <beanhuo@micron.com>
Cc: Can Guo <cang@codeaurora.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Link: https://lore.kernel.org/r/1578147968-30938-2-git-send-email-stanley.chu@mediatek.com
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c

index 1b97f2dc0b636b88f4cf7fe5d524b14d469c1b35..bae43da00bb66e7d22a105f5ab436af2bb65b2db 100644 (file)
@@ -385,7 +385,7 @@ static void ufshcd_print_err_hist(struct ufs_hba *hba,
        for (i = 0; i < UFS_ERR_REG_HIST_LENGTH; i++) {
                int p = (i + err_hist->pos) % UFS_ERR_REG_HIST_LENGTH;
 
-               if (err_hist->reg[p] == 0)
+               if (err_hist->tstamp[p] == 0)
                        continue;
                dev_err(hba->dev, "%s[%d] = 0x%x at %lld us\n", err_name, p,
                        err_hist->reg[p], ktime_to_us(err_hist->tstamp[p]));