2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-29 15:43:59 +08:00

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.com
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Stanley Chu 2020-07-24 22:16:27 +08:00 committed by Martin K. Petersen
parent 68e12e5f61
commit 0255b1e3d8

View File

@ -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)