All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu: rockchip: Fix missing unwind goto in rk_iommu_probe()
@ 2023-03-17  7:25 ` Harshit Mogalapalli
  0 siblings, 0 replies; 4+ messages in thread
From: Harshit Mogalapalli @ 2023-03-17  7:25 UTC (permalink / raw)
  Cc: error27, Harshit Mogalapalli, Joerg Roedel, Will Deacon,
	Robin Murphy, Heiko Stuebner, Marc Zyngier, Olof Johansson,
	iommu, linux-arm-kernel, linux-rockchip, linux-kernel

Smatch reports:
	drivers/iommu/rockchip-iommu.c:1306
	rk_iommu_probe() warn: missing unwind goto?

Smatch detects that when (irq < 0) we are directly returning without
doing the cleanup.

Fix this by adding a pm_runtime_disable(dev), and using correct goto
label 'err_remove_sysfs' instead of a direct return.

Fixes: 1aa55ca9b14a ("iommu/rockchip: Move irq request past pm_runtime_enable")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is purely based on static analysis. Only compile tested.
---
 drivers/iommu/rockchip-iommu.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index f30db22ea5d7..0751f2e757fd 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -1302,8 +1302,11 @@ static int rk_iommu_probe(struct platform_device *pdev)
 	for (i = 0; i < iommu->num_irq; i++) {
 		int irq = platform_get_irq(pdev, i);
 
-		if (irq < 0)
-			return irq;
+		if (irq < 0) {
+			pm_runtime_disable(dev);
+			err = irq;
+			goto err_remove_sysfs;
+		}
 
 		err = devm_request_irq(iommu->dev, irq, rk_iommu_irq,
 				       IRQF_SHARED, dev_name(dev), iommu);
-- 
2.38.1


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

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

* [PATCH] iommu: rockchip: Fix missing unwind goto in rk_iommu_probe()
@ 2023-03-17  7:25 ` Harshit Mogalapalli
  0 siblings, 0 replies; 4+ messages in thread
From: Harshit Mogalapalli @ 2023-03-17  7:25 UTC (permalink / raw)
  Cc: error27, Harshit Mogalapalli, Joerg Roedel, Will Deacon,
	Robin Murphy, Heiko Stuebner, Marc Zyngier, Olof Johansson,
	iommu, linux-arm-kernel, linux-rockchip, linux-kernel

Smatch reports:
	drivers/iommu/rockchip-iommu.c:1306
	rk_iommu_probe() warn: missing unwind goto?

Smatch detects that when (irq < 0) we are directly returning without
doing the cleanup.

Fix this by adding a pm_runtime_disable(dev), and using correct goto
label 'err_remove_sysfs' instead of a direct return.

Fixes: 1aa55ca9b14a ("iommu/rockchip: Move irq request past pm_runtime_enable")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is purely based on static analysis. Only compile tested.
---
 drivers/iommu/rockchip-iommu.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index f30db22ea5d7..0751f2e757fd 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -1302,8 +1302,11 @@ static int rk_iommu_probe(struct platform_device *pdev)
 	for (i = 0; i < iommu->num_irq; i++) {
 		int irq = platform_get_irq(pdev, i);
 
-		if (irq < 0)
-			return irq;
+		if (irq < 0) {
+			pm_runtime_disable(dev);
+			err = irq;
+			goto err_remove_sysfs;
+		}
 
 		err = devm_request_irq(iommu->dev, irq, rk_iommu_irq,
 				       IRQF_SHARED, dev_name(dev), iommu);
-- 
2.38.1


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

* [PATCH] iommu: rockchip: Fix missing unwind goto in rk_iommu_probe()
@ 2023-03-17  7:25 ` Harshit Mogalapalli
  0 siblings, 0 replies; 4+ messages in thread
From: Harshit Mogalapalli @ 2023-03-17  7:25 UTC (permalink / raw)
  Cc: error27, Harshit Mogalapalli, Joerg Roedel, Will Deacon,
	Robin Murphy, Heiko Stuebner, Marc Zyngier, Olof Johansson,
	iommu, linux-arm-kernel, linux-rockchip, linux-kernel

Smatch reports:
	drivers/iommu/rockchip-iommu.c:1306
	rk_iommu_probe() warn: missing unwind goto?

Smatch detects that when (irq < 0) we are directly returning without
doing the cleanup.

Fix this by adding a pm_runtime_disable(dev), and using correct goto
label 'err_remove_sysfs' instead of a direct return.

Fixes: 1aa55ca9b14a ("iommu/rockchip: Move irq request past pm_runtime_enable")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is purely based on static analysis. Only compile tested.
---
 drivers/iommu/rockchip-iommu.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index f30db22ea5d7..0751f2e757fd 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -1302,8 +1302,11 @@ static int rk_iommu_probe(struct platform_device *pdev)
 	for (i = 0; i < iommu->num_irq; i++) {
 		int irq = platform_get_irq(pdev, i);
 
-		if (irq < 0)
-			return irq;
+		if (irq < 0) {
+			pm_runtime_disable(dev);
+			err = irq;
+			goto err_remove_sysfs;
+		}
 
 		err = devm_request_irq(iommu->dev, irq, rk_iommu_irq,
 				       IRQF_SHARED, dev_name(dev), iommu);
-- 
2.38.1


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

* [PATCH] iommu: rockchip: Fix missing unwind goto in rk_iommu_probe()
@ 2023-03-17  7:25 ` Harshit Mogalapalli
  0 siblings, 0 replies; 4+ messages in thread
From: Harshit Mogalapalli @ 2023-03-17  7:25 UTC (permalink / raw)
  Cc: error27, Harshit Mogalapalli, Joerg Roedel, Will Deacon,
	Robin Murphy, Heiko Stuebner, Marc Zyngier, Olof Johansson,
	iommu, linux-arm-kernel, linux-rockchip, linux-kernel

Smatch reports:
	drivers/iommu/rockchip-iommu.c:1306
	rk_iommu_probe() warn: missing unwind goto?

Smatch detects that when (irq < 0) we are directly returning without
doing the cleanup.

Fix this by adding a pm_runtime_disable(dev), and using correct goto
label 'err_remove_sysfs' instead of a direct return.

Fixes: 1aa55ca9b14a ("iommu/rockchip: Move irq request past pm_runtime_enable")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is purely based on static analysis. Only compile tested.
---
 drivers/iommu/rockchip-iommu.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index f30db22ea5d7..0751f2e757fd 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -1302,8 +1302,11 @@ static int rk_iommu_probe(struct platform_device *pdev)
 	for (i = 0; i < iommu->num_irq; i++) {
 		int irq = platform_get_irq(pdev, i);
 
-		if (irq < 0)
-			return irq;
+		if (irq < 0) {
+			pm_runtime_disable(dev);
+			err = irq;
+			goto err_remove_sysfs;
+		}
 
 		err = devm_request_irq(iommu->dev, irq, rk_iommu_irq,
 				       IRQF_SHARED, dev_name(dev), iommu);
-- 
2.38.1


_______________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2023-03-17  7:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17  7:25 [PATCH] iommu: rockchip: Fix missing unwind goto in rk_iommu_probe() Harshit Mogalapalli
2023-03-17  7:25 ` Harshit Mogalapalli
2023-03-17  7:25 ` Harshit Mogalapalli
2023-03-17  7:25 ` Harshit Mogalapalli

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.