From: Marion & Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Peter Rosin <peda@axentia.se>,
"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: *** SPAM *** [PATCH] i2c: mux: demux-pinctrl: do not deactivate a master that is not active
Date: Wed, 2 Mar 2022 20:42:08 +0100 [thread overview]
Message-ID: <e0dc7291-b1a3-0cd2-32c9-d3486e591c5f@wanadoo.fr> (raw)
In-Reply-To: <eca2bf56-7abd-55c0-a423-dce47c38fd66@axentia.se>
Le 02/03/2022 à 12:22, Peter Rosin a écrit :
> Attempting to rollback the activation of the current master when
> the current master has not been activated is bad. priv->cur_chan
> and priv->cur_adap are both still zeroed out and the rollback
> may result in attempts to revert an of changeset that has not been
> applied and do result in calls to both del and put the zeroed out
> i2c_adapter. Maybe it crashes, or whatever, but it's bad in any
> case.
>
> Fixes: e9d1a0a41d44 ("i2c: mux: demux-pinctrl: Fix an error handling path in 'i2c_demux_pinctrl_probe()'")
> Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
> drivers/i2c/muxes/i2c-demux-pinctrl.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> Hi!
>
> Either that, or I'm missing something. I found this issue when
> reading code, and have made no tests to verify if my analysis
> is correct.
>
> Cheers,
> Peter
>
> diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c
> index 5365199a31f4..f7a7405d4350 100644
> --- a/drivers/i2c/muxes/i2c-demux-pinctrl.c
> +++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c
> @@ -261,7 +261,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
>
> err = device_create_file(&pdev->dev, &dev_attr_available_masters);
> if (err)
> - goto err_rollback;
> + goto err_rollback_activation;
>
> err = device_create_file(&pdev->dev, &dev_attr_current_master);
> if (err)
> @@ -271,8 +271,9 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
>
> err_rollback_available:
> device_remove_file(&pdev->dev, &dev_attr_available_masters);
> -err_rollback:
> +err_rollback_activation:
> i2c_demux_deactivate_master(priv);
> +err_rollback:
> for (j = 0; j < i; j++) {
> of_node_put(priv->chan[j].parent_np);
> of_changeset_destroy(&priv->chan[j].chgset);
For what it worth, LGTM.
CJ
next prev parent reply other threads:[~2022-03-02 19:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-02 11:22 Peter Rosin
2022-03-02 19:42 ` Marion & Christophe JAILLET [this message]
2022-03-02 21:17 ` Wolfram Sang
2022-03-02 21:22 ` Wolfram Sang
2022-03-02 22:45 ` Peter Rosin
2022-03-19 23:55 ` Wolfram Sang
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=e0dc7291-b1a3-0cd2-32c9-d3486e591c5f@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peda@axentia.se \
--cc=wsa+renesas@sang-engineering.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
all inboxes | Powered by JetHome®