From: Nishanth Menon <nm@ti.com>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: <kernel-janitors@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
Santosh Shilimkar <ssantosh@kernel.org>,
Tero Kristo <kristo@kernel.org>, <cocci@inria.fr>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [cocci] [PATCH] firmware: ti_sci: Fix exception handling in ti_sci_probe()
Date: Tue, 16 May 2023 10:20:43 -0500 [thread overview]
Message-ID: <20230516152043.bq2hnessstrhbc6s@distort> (raw)
In-Reply-To: <f1eaec48-cabb-5fc6-942b-f1ef7af9bb57@web.de>
On 22:10-20230405, Markus Elfring wrote:
> Date: Wed, 5 Apr 2023 22:00:18 +0200
B4 does'nt pick this patch up cleanly. And for some reason, I get
mangled patch from public-inbox as well :( a clean git-send-email might
help.
>
> The label “out” was used to jump to another pointer check despite of
Please use " for quotes.
> the detail in the implementation of the function “ti_sci_probe”
> that it was determined already that the corresponding variable
> contained an error pointer because of a failed call of
> the function “mbox_request_channel_byname”.
>
> * Thus use more appropriate labels instead.
>
> * Delete two redundant checks.
>
How about this:
Optimize out the redundant pointer check in exit path of "out" using
appropriate labels to jump in the error path
>
Drop the extra EoL
> This issue was detected by using the Coccinelle software.
Curious: what rule of coccicheck caught this?
>
> Fixes: aa276781a64a5f15ecc21e920960c5b1f84e5fee ("firmware: Add basic support for TI System Control Interface (TI-SCI) protocol")
12 char sha please. Please read Documentation/process/submitting-patches.rst
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/firmware/ti_sci.c | 19 ++++++++++---------
> 1 file changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
> index 039d92a595ec..77012d2f4160 100644
> --- a/drivers/firmware/ti_sci.c
turns out as =2D-- instead of -- (might check the git format-patch
output closer).
> +++ b/drivers/firmware/ti_sci.c
> @@ -3433,18 +3433,18 @@ static int ti_sci_probe(struct platform_device *pdev)
> info->chan_rx = mbox_request_channel_byname(cl, "rx");
> if (IS_ERR(info->chan_rx)) {
> ret = PTR_ERR(info->chan_rx);
> - goto out;
> + goto remove_debugfs;
> }
>
> info->chan_tx = mbox_request_channel_byname(cl, "tx");
> if (IS_ERR(info->chan_tx)) {
> ret = PTR_ERR(info->chan_tx);
> - goto out;
> + goto free_mbox_channel_rx;
> }
> ret = ti_sci_cmd_get_revision(info);
> if (ret) {
> dev_err(dev, "Unable to communicate with TISCI(%d)\n", ret);
> - goto out;
> + goto free_mbox_channel_tx;
> }
>
> ti_sci_setup_ops(info);
> @@ -3456,7 +3456,7 @@ static int ti_sci_probe(struct platform_device *pdev)
> ret = register_restart_handler(&info->nb);
> if (ret) {
> dev_err(dev, "reboot registration fail(%d)\n", ret);
> - goto out;
> + goto free_mbox_channel_tx;
> }
> }
>
> @@ -3470,11 +3470,12 @@ static int ti_sci_probe(struct platform_device *pdev)
> mutex_unlock(&ti_sci_list_mutex);
>
> return of_platform_populate(dev->of_node, NULL, NULL, dev);
> -out:
> - if (!IS_ERR(info->chan_tx))
> - mbox_free_channel(info->chan_tx);
> - if (!IS_ERR(info->chan_rx))
> - mbox_free_channel(info->chan_rx);
> +
> +free_mbox_channel_tx:
> + mbox_free_channel(info->chan_tx);
> +free_mbox_channel_rx:
> + mbox_free_channel(info->chan_rx);
> +remove_debugfs:
> debugfs_remove(info->d);
> return ret;
> }
> --
> 2.40.0
>
--
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-05-16 15:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <f9303bdc-b1a7-be5e-56c6-dfa8232b8b55@web.de>
[not found] ` <5ed1bc78-77a1-8eb8-43f9-6005d7de49c8@web.de>
2023-03-25 14:05 ` [PATCH resent] clk: at91: sama7g5: Add two jump labels in sama7g5_pmc_setup() Markus Elfring
2023-03-28 8:30 ` Nicolas Ferre
2023-03-28 19:24 ` Markus Elfring
2023-03-28 22:02 ` Alexandre Belloni
[not found] ` <8f785de5-ebe2-edd9-2155-f440acacc643@web.de>
2023-04-05 20:10 ` [PATCH] firmware: ti_sci: Fix exception handling in ti_sci_probe() Markus Elfring
2023-05-16 15:20 ` Nishanth Menon [this message]
2023-05-16 15:56 ` [cocci] " Markus Elfring
2023-05-17 6:43 ` [cocci] [PATCH] " Dan Carpenter
2023-04-06 20:12 ` [PATCH] remoteproc: imx_dsp_rproc: Improve exception handling in imx_dsp_rproc_mbox_alloc() Markus Elfring
2023-04-10 17:44 ` Mathieu Poirier
2023-04-07 6:22 ` [PATCH] spi: atmel: Improve exception handling in atmel_spi_configure_dma() Markus Elfring
2023-04-07 7:54 ` Nicolas Ferre
2023-04-07 15:07 ` Markus Elfring
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=20230516152043.bq2hnessstrhbc6s@distort \
--to=nm@ti.com \
--cc=Markus.Elfring@web.de \
--cc=cocci@inria.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=kristo@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ssantosh@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).