From: 张网 <m202171703@hust.edu.cn>
To: "Peter Korsgaard" <peter@korsgaard.com>, "Andrew Lunn" <andrew@lunn.ch>
Cc: hust-os-kernel-patches@googlegroups.com,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] i2c: ocores: add missing unwind goto in `ocores_i2c_probe`
Date: Tue, 25 Apr 2023 18:31:04 +0800 (GMT+08:00) [thread overview]
Message-ID: <310e91c6.439bc.187b7f784f3.Coremail.m202171703@hust.edu.cn> (raw)
In-Reply-To: <20230418053814.117215-1-silver_code@hust.edu.cn>
I'm sorry for sending the error ping message.
The related patch has fixed the issue by changing the ocores_i2c_of_probe function to use devm_clk_get_optional_enabled().
This new patch only requires a minor modification, and there is no need to add a check for clk_disable_unprepare
as it already has checks for error pointers and NULL values.
Best regards,
Wang Zhang
"Wang Zhang" <silver_code@hust.edu.cn>写道:
> Smatch Warns:
> drivers/i2c/busses/i2c-ocores.c:701 ocores_i2c_probe() warn:
> missing unwind goto?
>
> 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 after platform_get_irq_optional.
>
> Fix this by changing the direct return to `goto err_clk`.
>
> Signed-off-by: Wang Zhang <silver_code@hust.edu.cn>
> ---
> v2->v3: the first patch had issues. Just do a much simpler fix. No need
> to add the check. clk_disable_unprepare() has checks for error pointer
> and NULL already.
> v1->v2: change `ocores_i2c_of_probe` to use `devm_clk_get_enabled()`
> ---
> This patch was found by static analyzer.
> ...
> 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 2e575856c5cd..1df1439218c9 100644
> --- a/drivers/i2c/busses/i2c-ocores.c
> +++ b/drivers/i2c/busses/i2c-ocores.c
> @@ -700,8 +700,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
prev parent reply other threads:[~2023-04-25 10:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 5:38 [PATCH v3] i2c: ocores: add missing unwind goto in `ocores_i2c_probe` Wang Zhang
2023-04-18 5:45 ` Dan Carpenter
2023-04-18 7:15 ` Dan Carpenter
2023-04-25 10:31 ` 张网 [this message]
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=310e91c6.439bc.187b7f784f3.Coremail.m202171703@hust.edu.cn \
--to=m202171703@hust.edu.cn \
--cc=andrew@lunn.ch \
--cc=hust-os-kernel-patches@googlegroups.com \
--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