All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] scsi: ufs-mediatek: Prevent LPM operation on undeclared VCC
@ 2020-07-24 14:16 ` Stanley Chu
  0 siblings, 0 replies; 9+ messages in thread
From: Stanley Chu @ 2020-07-24 14:16 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb, bvanassche
  Cc: beanhuo, asutoshd, cang, matthias.bgg, linux-mediatek,
	linux-arm-kernel, linux-kernel, kuohong.wang, peter.wang,
	chun-hung.wu, andy.teng, chaotian.jing, cc.chou, Stanley Chu

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.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufs-mediatek.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index 31af8b3d2b53..66223fe200fc 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -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)
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v1] scsi: ufs-mediatek: Prevent LPM operation on undeclared VCC
@ 2020-07-24 14:16 ` Stanley Chu
  0 siblings, 0 replies; 9+ messages in thread
From: Stanley Chu @ 2020-07-24 14:16 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb, bvanassche
  Cc: Stanley Chu, andy.teng, cc.chou, chun-hung.wu, kuohong.wang,
	linux-kernel, cang, linux-mediatek, peter.wang, matthias.bgg,
	beanhuo, chaotian.jing, linux-arm-kernel, asutoshd

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.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufs-mediatek.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index 31af8b3d2b53..66223fe200fc 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -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)
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v1] scsi: ufs-mediatek: Prevent LPM operation on undeclared VCC
@ 2020-07-24 14:16 ` Stanley Chu
  0 siblings, 0 replies; 9+ messages in thread
From: Stanley Chu @ 2020-07-24 14:16 UTC (permalink / raw)
  To: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb, bvanassche
  Cc: Stanley Chu, andy.teng, cc.chou, chun-hung.wu, kuohong.wang,
	linux-kernel, cang, linux-mediatek, peter.wang, matthias.bgg,
	beanhuo, chaotian.jing, linux-arm-kernel, asutoshd

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.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufs-mediatek.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index 31af8b3d2b53..66223fe200fc 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -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)
-- 
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* RE: [PATCH v1] scsi: ufs-mediatek: Prevent LPM operation on undeclared VCC
  2020-07-24 14:16 ` Stanley Chu
  (?)
@ 2020-07-27 10:56   ` Avri Altman
  -1 siblings, 0 replies; 9+ messages in thread
From: Avri Altman @ 2020-07-27 10:56 UTC (permalink / raw)
  To: Stanley Chu, linux-scsi, martin.petersen, alim.akhtar, jejb, bvanassche
  Cc: beanhuo, asutoshd, cang, matthias.bgg, linux-mediatek,
	linux-arm-kernel, linux-kernel, kuohong.wang, peter.wang,
	chun-hung.wu, andy.teng, chaotian.jing, cc.chou

 
> 
> 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.
> 
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH v1] scsi: ufs-mediatek: Prevent LPM operation on undeclared VCC
@ 2020-07-27 10:56   ` Avri Altman
  0 siblings, 0 replies; 9+ messages in thread
From: Avri Altman @ 2020-07-27 10:56 UTC (permalink / raw)
  To: Stanley Chu, linux-scsi, martin.petersen, alim.akhtar, jejb, bvanassche
  Cc: andy.teng, cc.chou, chun-hung.wu, kuohong.wang, linux-kernel,
	cang, linux-mediatek, peter.wang, matthias.bgg, beanhuo,
	chaotian.jing, linux-arm-kernel, asutoshd

 
> 
> 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.
> 
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH v1] scsi: ufs-mediatek: Prevent LPM operation on undeclared VCC
@ 2020-07-27 10:56   ` Avri Altman
  0 siblings, 0 replies; 9+ messages in thread
From: Avri Altman @ 2020-07-27 10:56 UTC (permalink / raw)
  To: Stanley Chu, linux-scsi, martin.petersen, alim.akhtar, jejb, bvanassche
  Cc: andy.teng, cc.chou, chun-hung.wu, kuohong.wang, linux-kernel,
	cang, linux-mediatek, peter.wang, matthias.bgg, beanhuo,
	chaotian.jing, linux-arm-kernel, asutoshd

 
> 
> 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.
> 
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1] scsi: ufs-mediatek: Prevent LPM operation on undeclared VCC
  2020-07-24 14:16 ` Stanley Chu
  (?)
@ 2020-07-29  4:10   ` Martin K. Petersen
  -1 siblings, 0 replies; 9+ messages in thread
From: Martin K. Petersen @ 2020-07-29  4:10 UTC (permalink / raw)
  To: Stanley Chu, alim.akhtar, linux-scsi, bvanassche, avri.altman, jejb
  Cc: Martin K . Petersen, matthias.bgg, linux-arm-kernel, asutoshd,
	chaotian.jing, linux-kernel, chun-hung.wu, cc.chou, kuohong.wang,
	andy.teng, peter.wang, linux-mediatek, beanhuo, cang

On Fri, 24 Jul 2020 22:16:27 +0800, Stanley Chu wrote:

> 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.

Applied to 5.9/scsi-queue, thanks!

[1/1] scsi: ufs-mediatek: Prevent LPM operation on undeclared VCC
      https://git.kernel.org/mkp/scsi/c/0255b1e3d849

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1] scsi: ufs-mediatek: Prevent LPM operation on undeclared VCC
@ 2020-07-29  4:10   ` Martin K. Petersen
  0 siblings, 0 replies; 9+ messages in thread
From: Martin K. Petersen @ 2020-07-29  4:10 UTC (permalink / raw)
  To: Stanley Chu, alim.akhtar, linux-scsi, bvanassche, avri.altman, jejb
  Cc: Martin K . Petersen, andy.teng, cc.chou, chun-hung.wu,
	kuohong.wang, linux-kernel, cang, linux-mediatek,
	linux-arm-kernel, matthias.bgg, beanhuo, peter.wang,
	chaotian.jing, asutoshd

On Fri, 24 Jul 2020 22:16:27 +0800, Stanley Chu wrote:

> 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.

Applied to 5.9/scsi-queue, thanks!

[1/1] scsi: ufs-mediatek: Prevent LPM operation on undeclared VCC
      https://git.kernel.org/mkp/scsi/c/0255b1e3d849

-- 
Martin K. Petersen	Oracle Linux Engineering

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1] scsi: ufs-mediatek: Prevent LPM operation on undeclared VCC
@ 2020-07-29  4:10   ` Martin K. Petersen
  0 siblings, 0 replies; 9+ messages in thread
From: Martin K. Petersen @ 2020-07-29  4:10 UTC (permalink / raw)
  To: Stanley Chu, alim.akhtar, linux-scsi, bvanassche, avri.altman, jejb
  Cc: Martin K . Petersen, andy.teng, cc.chou, chun-hung.wu,
	kuohong.wang, linux-kernel, cang, linux-mediatek,
	linux-arm-kernel, matthias.bgg, beanhuo, peter.wang,
	chaotian.jing, asutoshd

On Fri, 24 Jul 2020 22:16:27 +0800, Stanley Chu wrote:

> 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.

Applied to 5.9/scsi-queue, thanks!

[1/1] scsi: ufs-mediatek: Prevent LPM operation on undeclared VCC
      https://git.kernel.org/mkp/scsi/c/0255b1e3d849

-- 
Martin K. Petersen	Oracle Linux Engineering

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-07-29  4:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-24 14:16 [PATCH v1] scsi: ufs-mediatek: Prevent LPM operation on undeclared VCC Stanley Chu
2020-07-24 14:16 ` Stanley Chu
2020-07-24 14:16 ` Stanley Chu
2020-07-27 10:56 ` Avri Altman
2020-07-27 10:56   ` Avri Altman
2020-07-27 10:56   ` Avri Altman
2020-07-29  4:10 ` Martin K. Petersen
2020-07-29  4:10   ` Martin K. Petersen
2020-07-29  4:10   ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.