Commit 0255b1e3 authored by Stanley Chu's avatar Stanley Chu Committed by Martin K. Petersen

scsi: ufs-mediatek: Prevent LPM operation on undeclared VCC

In some platforms, VCC regulator may not be declared in device tree to keep
itself "always-on". In this case, hba->vreg_info.vcc is NULL and shall not
be operated during any flow.

Prevent possible NULL hba->vreg_info.vcc access in LPM mode by checking
if it is valid first.

Link: https://lore.kernel.org/r/20200724141627.20094-1-stanley.chu@mediatek.comReviewed-by: default avatarAvri Altman <avri.altman@wdc.com>
Signed-off-by: default avatarStanley Chu <stanley.chu@mediatek.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 68e12e5f
......@@ -574,7 +574,7 @@ static int ufs_mtk_link_set_lpm(struct ufs_hba *hba)
static void ufs_mtk_vreg_set_lpm(struct ufs_hba *hba, bool lpm)
{
if (!hba->vreg_info.vccq2)
if (!hba->vreg_info.vccq2 || !hba->vreg_info.vcc)
return;
if (lpm & !hba->vreg_info.vcc->enabled)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment