* [PATCH] i2c: i801: Avoid potential double call to gpiod_remove_lookup_table
@ 2024-02-23 7:11 Heiner Kallweit
2024-02-23 7:52 ` Heiner Kallweit
0 siblings, 1 reply; 2+ messages in thread
From: Heiner Kallweit @ 2024-02-23 7:11 UTC (permalink / raw)
To: Jean Delvare, Andi Shyti; +Cc: linux-i2c@vger.kernel.org
If registering the platform device fails, the lookup table is
removed in the error path. On module removal we would try to
remove the lookup table again. Fix this by leaving it to
i801_del_mux() to clean up.
Fixes: d308dfbf62ef ("i2c: mux/i801: Switch to use descriptor passing")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/i2c/busses/i2c-i801.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 4b9d04f20..223cd2b84 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -1457,10 +1457,8 @@ static void i801_add_mux(struct i801_priv *priv)
priv->mux_pdev = platform_device_register_data(dev, "i2c-mux-gpio",
PLATFORM_DEVID_NONE, &gpio_data,
sizeof(struct i2c_mux_gpio_platform_data));
- if (IS_ERR(priv->mux_pdev)) {
- gpiod_remove_lookup_table(lookup);
+ if (IS_ERR(priv->mux_pdev))
dev_err(dev, "Failed to register i2c-mux-gpio device\n");
- }
}
static void i801_del_mux(struct i801_priv *priv)
--
2.43.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] i2c: i801: Avoid potential double call to gpiod_remove_lookup_table
2024-02-23 7:11 [PATCH] i2c: i801: Avoid potential double call to gpiod_remove_lookup_table Heiner Kallweit
@ 2024-02-23 7:52 ` Heiner Kallweit
0 siblings, 0 replies; 2+ messages in thread
From: Heiner Kallweit @ 2024-02-23 7:52 UTC (permalink / raw)
To: Jean Delvare, Andi Shyti; +Cc: linux-i2c@vger.kernel.org
On 23.02.2024 08:11, Heiner Kallweit wrote:
> If registering the platform device fails, the lookup table is
> removed in the error path. On module removal we would try to
> remove the lookup table again. Fix this by leaving it to
> i801_del_mux() to clean up.
>
> Fixes: d308dfbf62ef ("i2c: mux/i801: Switch to use descriptor passing")
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> drivers/i2c/busses/i2c-i801.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
> index 4b9d04f20..223cd2b84 100644
> --- a/drivers/i2c/busses/i2c-i801.c
> +++ b/drivers/i2c/busses/i2c-i801.c
> @@ -1457,10 +1457,8 @@ static void i801_add_mux(struct i801_priv *priv)
> priv->mux_pdev = platform_device_register_data(dev, "i2c-mux-gpio",
> PLATFORM_DEVID_NONE, &gpio_data,
> sizeof(struct i2c_mux_gpio_platform_data));
> - if (IS_ERR(priv->mux_pdev)) {
> - gpiod_remove_lookup_table(lookup);
> + if (IS_ERR(priv->mux_pdev))
> dev_err(dev, "Failed to register i2c-mux-gpio device\n");
> - }
> }
>
> static void i801_del_mux(struct i801_priv *priv)
Forgot to cc stable in both patches. I'll wait for other feedback and will
submit a v2 afterwards.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-23 7:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23 7:11 [PATCH] i2c: i801: Avoid potential double call to gpiod_remove_lookup_table Heiner Kallweit
2024-02-23 7:52 ` Heiner Kallweit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox