From: Wang Zhang <silver_code@hust.edu.cn>
To: Peter Korsgaard <peter@korsgaard.com>, Andrew Lunn <andrew@lunn.ch>
Cc: Wang Zhang <silver_code@hust.edu.cn>,
Dongliang Mu <dzm91@hust.edu.cn>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] i2c: ocores: add missing unwind goto in `ocores_i2c_probe`
Date: Sun, 16 Apr 2023 15:18:54 +0800 [thread overview]
Message-ID: <20230416071854.58335-1-silver_code@hust.edu.cn> (raw)
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
next reply other threads:[~2023-04-16 7:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-16 7:18 Wang Zhang [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-04-16 7:20 [PATCH] i2c: ocores: add missing unwind goto in `ocores_i2c_probe` Wang Zhang
2023-04-16 15:33 ` Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230416071854.58335-1-silver_code@hust.edu.cn \
--to=silver_code@hust.edu.cn \
--cc=andrew@lunn.ch \
--cc=dzm91@hust.edu.cn \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter@korsgaard.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.