From 4eb78fc2b5321deeaff5755f51566d8a3f34ab41 Mon Sep 17 00:00:00 2001 From: Asutosh Das Date: Mon, 6 Jan 2020 15:26:39 -0800 Subject: [PATCH] scsi: ufs-qti: Check for valid vcc before accessing This patch fixes a NULL pointer dereference by checking if vccq & vccq2 are valid before dereferencing it. Change-Id: Ieb5aefab77428adbbbbf892f2be1a9942d7c3851 Signed-off-by: Asutosh Das --- drivers/scsi/ufs/ufshcd-qti.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd-qti.c b/drivers/scsi/ufs/ufshcd-qti.c index 729a0b91d9f0..60c4e4b31de7 100644 --- a/drivers/scsi/ufs/ufshcd-qti.c +++ b/drivers/scsi/ufs/ufshcd-qti.c @@ -8323,9 +8323,9 @@ reinit: * during system suspend events. This will cause the UFS * device to re-initialize upon system resume events. */ - if ((hba->dev_info.w_spec_version >= 0x300 && + if ((hba->dev_info.w_spec_version >= 0x300 && hba->vreg_info.vccq && hba->vreg_info.vccq->sys_suspend_pwr_off) || - (hba->dev_info.w_spec_version < 0x300 && + (hba->dev_info.w_spec_version < 0x300 && hba->vreg_info.vccq2 && hba->vreg_info.vccq2->sys_suspend_pwr_off)) hba->spm_lvl = ufs_get_desired_pm_lvl_for_dev_link_state( UFS_POWERDOWN_PWR_MODE,