public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
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:20:40 +0800	[thread overview]
Message-ID: <20230416072040.58373-1-silver_code@hust.edu.cn> (raw)

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


             reply	other threads:[~2023-04-16  7:31 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-16  7:20 Wang Zhang [this message]
2023-04-16 15:33 ` [PATCH] i2c: ocores: add missing unwind goto in `ocores_i2c_probe` Andrew Lunn
2023-04-17 13:27   ` [PATCH v2] i2c: ocores: use devm_ managed clks Wang Zhang
2023-04-17 14:05   ` Wang Zhang
2023-04-17 14:29     ` Peter Rosin
2023-04-17 15:50     ` Andrew Lunn
2023-04-22 12:32       ` [PATCH v3] " Wang Zhang
2023-04-25  9:58         ` 张网
2023-04-25 11:57         ` Andrew Lunn
2023-04-25 14:47           ` 张网
2023-04-25 15:06             ` Andrew Lunn
2023-05-26  7:05               ` [PATCH v4] " Wang Zhang
2023-06-13 23:54                 ` Andi Shyti
2023-06-23  8:22                 ` Wolfram Sang
2023-06-23  8:26                   ` Wolfram Sang
2023-05-23  4:49           ` Re: [PATCH v3] " 张网
2023-05-23 12:10             ` Andrew Lunn
2023-05-23 14:33             ` Wang Zhang
2023-05-24 15:35             ` Wang Zhang
2023-05-24 15:43             ` Wang Zhang
2023-05-24 18:45               ` Dan Carpenter
2023-05-24 19:21               ` Christophe JAILLET
2023-05-25  3:33                 ` 张网
2023-05-25 19:16                   ` Christophe JAILLET
2023-05-25  5:05                 ` Dan Carpenter
2023-05-25  5:02               ` Dan Carpenter
2023-05-25  9:28                 ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2023-04-16  7:18 [PATCH] i2c: ocores: add missing unwind goto in `ocores_i2c_probe` Wang Zhang

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=20230416072040.58373-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox