From: Frank Li <Frank.li@nxp.com>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: linux-i3c@lists.infradead.org,
"Adrian Ng Ho Yin" <adrianhoyin.ng@altera.com>,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
Aniket <aniketmaurya@google.com>,
"Fredrik Markstrom" <fredrik.markstrom@est.tech>,
"Ivar Holmqvist" <ivar.holmqvist@est.tech>,
"Jorge Marques" <jorge.marques@analog.com>,
"Manikanta Guntupalli" <manikanta.guntupalli@amd.com>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
"Zilin Guan" <zilin@seu.edu.cn>,
LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org, cocci@inria.fr,
"Jianhao Xu" <jianhao.xu@seu.edu.cn>,
"Nuno Sá" <noname.nuno@gmail.com>
Subject: Re: [PATCH] i3c: dw: Complete exception handling in dw_i3c_master_i3c_xfers()
Date: Mon, 2 Mar 2026 15:25:12 -0500 [thread overview]
Message-ID: <aaXyKP4txWXQM6Ff@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <44203b94-0d4d-4411-9f9e-103ef19172b6@web.de>
On Sun, Mar 01, 2026 at 07:25:51PM +0100, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 1 Mar 2026 19:11:51 +0100
>
> A dw_i3c_xfer structure is allocated by a dw_i3c_master_alloc_xfer() call.
> It is not released after a failed pm_runtime_resume_and_get() call.
>
> Thus use an additional label so that the affected memory is always be freed
> at the end of this function implementation.
>
> This issue was detected by using the Coccinelle software.
>
> Fixes: 62fe9d06f5709caa1fa68055873ff279e05ade37 ("i3c: dw: Add power management support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/i3c/master/dw-i3c-master.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index d87bde3f7700..723f185584d0 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -953,7 +953,7 @@ static int dw_i3c_master_i3c_xfers(struct i3c_dev_desc *dev,
> dev_err(master->dev,
> "<%s> cannot resume i3c bus master, err: %d\n",
> __func__, ret);
> - return ret;
> + goto free_xfer;
> }
>
> for (i = 0; i < i3c_nxfers; i++) {
> @@ -994,10 +994,10 @@ static int dw_i3c_master_i3c_xfers(struct i3c_dev_desc *dev,
> i3c_xfers[i].len = cmd->rx_len;
> }
>
> + pm_runtime_put_autosuspend(master->dev);
> ret = xfer->ret;
> +free_xfer:
> dw_i3c_master_free_xfer(xfer);
> -
> - pm_runtime_put_autosuspend(master->dev);
> return ret;
> }
>
> --
> 2.53.0
>
prev parent reply other threads:[~2026-03-02 20:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-01 18:25 Markus Elfring
2026-03-02 20:25 ` Frank Li [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=aaXyKP4txWXQM6Ff@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=Markus.Elfring@web.de \
--cc=adrianhoyin.ng@altera.com \
--cc=alexandre.belloni@bootlin.com \
--cc=aniketmaurya@google.com \
--cc=cocci@inria.fr \
--cc=fredrik.markstrom@est.tech \
--cc=ivar.holmqvist@est.tech \
--cc=jianhao.xu@seu.edu.cn \
--cc=jorge.marques@analog.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-i3c@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manikanta.guntupalli@amd.com \
--cc=noname.nuno@gmail.com \
--cc=sakari.ailus@linux.intel.com \
--cc=wsa+renesas@sang-engineering.com \
--cc=zilin@seu.edu.cn \
/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
all inboxes | Powered by JetHome®