mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] i2c: ocores: add missing unwind goto in `ocores_i2c_probe`
@ 2023-04-16  7:18 Wang Zhang
  0 siblings, 0 replies; 3+ messages in thread
From: Wang Zhang @ 2023-04-16  7:18 UTC (permalink / raw)
  To: Peter Korsgaard, Andrew Lunn
  Cc: Wang Zhang, Dongliang Mu, linux-i2c, linux-kernel

The error handling code after the err_clk label should be executed to
release any resources that were allocated for the clock if a negative
error code returned.

Fix this by assigning irq to ret and changing the direct return to err_clk.

Signed-off-by: Wang Zhang <silver_code@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
---
 drivers/i2c/busses/i2c-ocores.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index a0af027db04c..95efad5a5a28 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -697,8 +697,10 @@ static int ocores_i2c_probe(struct platform_device *pdev)
 	if (irq == -ENXIO) {
 		ocores_algorithm.master_xfer = ocores_xfer_polling;
 	} else {
-		if (irq < 0)
-			return irq;
+		if (irq < 0) {
+			ret = irq;
+			goto err_clk;
+		}
 	}
 
 	if (ocores_algorithm.master_xfer != ocores_xfer_polling) {
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread
* [PATCH] i2c: ocores: add missing unwind goto in `ocores_i2c_probe`
@ 2023-04-16  7:20 Wang Zhang
  2023-04-16 15:33 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Wang Zhang @ 2023-04-16  7:20 UTC (permalink / raw)
  To: Peter Korsgaard, Andrew Lunn
  Cc: Wang Zhang, Dongliang Mu, linux-i2c, linux-kernel

platform_get_irq_optional is a function used to obtain an IRQ
number for a device on a platform. The function returns the IRQ number
associated with the specified device, or a negative error code if it fails.

The error handling code after the err_clk label should be executed to
release any resources that were allocated for the clock if a negative
error code returned.

Fix this by assigning irq to ret and changing the direct return to err_clk.

Signed-off-by: Wang Zhang <silver_code@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
---
 drivers/i2c/busses/i2c-ocores.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index a0af027db04c..95efad5a5a28 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -697,8 +697,10 @@ static int ocores_i2c_probe(struct platform_device *pdev)
 	if (irq == -ENXIO) {
 		ocores_algorithm.master_xfer = ocores_xfer_polling;
 	} else {
-		if (irq < 0)
-			return irq;
+		if (irq < 0) {
+			ret = irq;
+			goto err_clk;
+		}
 	}
 
 	if (ocores_algorithm.master_xfer != ocores_xfer_polling) {
-- 
2.34.1


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

end of thread, other threads:[~2023-04-16 15:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-16  7:18 [PATCH] i2c: ocores: add missing unwind goto in `ocores_i2c_probe` Wang Zhang
2023-04-16  7:20 Wang Zhang
2023-04-16 15:33 ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®