]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
scsi: ufs: Avoid configuring regulator with undefined voltage range
authorStanley Chu <stanley.chu@mediatek.com>
Thu, 28 Mar 2019 09:16:24 +0000 (17:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 May 2019 13:43:40 +0000 (06:43 -0700)
commit81ba6b9ddcc3ea0921cf85c4c88fec46f560c2ad
tree6ec865c3b788b32540117c0fa5eba401afb14d55
parentd59bc35df0ffdd56c44294af192b15ba2936bf6e
scsi: ufs: Avoid configuring regulator with undefined voltage range

[ Upstream commit 3b141e8cfd54ba3e5c610717295b2a02aab26a05 ]

For regulators used by UFS, vcc, vccq and vccq2 will have voltage range
initialized by ufshcd_populate_vreg(), however other regulators may have
undefined voltage range if dt-bindings have no such definition.

In above undefined case, both "min_uV" and "max_uV" fields in ufs_vreg
struct will be zero values and these values will be configured on
regulators in different power modes.

Currently this may have no harm if both "min_uV" and "max_uV" always keep
"zero values" because regulator_set_voltage() will always bypass such
invalid values and return "good" results.

However improper values shall be fixed to avoid potential bugs.  Simply
bypass voltage configuration if voltage range is not defined.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/ufs/ufshcd.c