[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230416071854.58335-1-silver_code@hust.edu.cn>
Date: Sun, 16 Apr 2023 15:18:54 +0800
From: Wang Zhang <silver_code@...t.edu.cn>
To: Peter Korsgaard <peter@...sgaard.com>, Andrew Lunn <andrew@...n.ch>
Cc: Wang Zhang <silver_code@...t.edu.cn>,
Dongliang Mu <dzm91@...t.edu.cn>, linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] i2c: ocores: add missing unwind goto in `ocores_i2c_probe`
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@...t.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@...t.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
Powered by blists - more mailing lists