Reviewed-by: Subhash Jadavani <[email protected]>
-----Original Message-----
From: Akinobu Mita [mailto:[email protected]]
Sent: Tuesday, November 18, 2014 6:03 AM
To: [email protected]
Cc: Akinobu Mita; Akinobu Mita; Vinayak Holikatti; Subhash Jadavani; Dolev
Raviv; Sujit Reddy Thumma; Yaniv Gardi; Christoph Hellwig; James E.J.
Bottomley
Subject: [PATCH 2/2] scsi: ufs: fix NULL dereference when no regulators are
defined
If no voltage supply regulators are defined for the UFS devices (assumed
they are always-on), ufshcd_config_vreg_load() can be called on
suspend/resume paths with vreg == NULL as hba->vreg_info.vcc* equal to NULL,
and it causes NULL pointer dereference.
This fixes it by making ufshcd_config_vreg_{h,l}pm noop when no regulators
are defined.
Signed-off-by: Akinobu Mita <[email protected]>
Cc: Vinayak Holikatti <[email protected]>
Cc: Subhash Jadavani <[email protected]>
Cc: Dolev Raviv <[email protected]>
Cc: Sujit Reddy Thumma <[email protected]>
Cc: Yaniv Gardi <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: "James E.J. Bottomley" <[email protected]>
Cc: [email protected]
---
drivers/scsi/ufs/ufshcd.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index
59b6544..d18adc4 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4248,12 +4248,18 @@ static int ufshcd_config_vreg_load(struct device
*dev, struct ufs_vreg *vreg, static inline int
ufshcd_config_vreg_lpm(struct ufs_hba *hba,
struct ufs_vreg *vreg)
{
+ if (!vreg)
+ return 0;
+
return ufshcd_config_vreg_load(hba->dev, vreg,
UFS_VREG_LPM_LOAD_UA); }
static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba,
struct ufs_vreg *vreg)
{
+ if (!vreg)
+ return 0;
+
return ufshcd_config_vreg_load(hba->dev, vreg, vreg->max_uA); }
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html