drivers/i2c/busses/i2c-omap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
If an error occurs after calling mux_state_select(), mux_state_deselect()
should be called as already done in the remove function.
Fixes: b6ef830c60b6 ("i2c: omap: Add support for setting mux")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
I'm not 100% sure of the error handling path.
Should pm_runtime_dont_use_autosuspend() be called after the err_disable_pm
label? (to match the calling order)
Also, should errors from omap_i2c_init() be handled?
---
drivers/i2c/busses/i2c-omap.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 876791d20ed5..5e46dc2cbbd7 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1461,13 +1461,13 @@ omap_i2c_probe(struct platform_device *pdev)
if (IS_ERR(mux_state)) {
r = PTR_ERR(mux_state);
dev_dbg(&pdev->dev, "failed to get I2C mux: %d\n", r);
- goto err_disable_pm;
+ goto err_put_pm;
}
omap->mux_state = mux_state;
r = mux_state_select(omap->mux_state);
if (r) {
dev_err(&pdev->dev, "failed to select I2C mux: %d\n", r);
- goto err_disable_pm;
+ goto err_put_pm;
}
}
@@ -1515,6 +1515,9 @@ omap_i2c_probe(struct platform_device *pdev)
err_unuse_clocks:
omap_i2c_write_reg(omap, OMAP_I2C_CON_REG, 0);
+ if (omap->mux_state)
+ mux_state_deselect(omap->mux_state);
+err_put_pm:
pm_runtime_dont_use_autosuspend(omap->dev);
pm_runtime_put_sync(omap->dev);
err_disable_pm:
--
2.49.0
Hi Christophe,
On Sat, Jun 14, 2025 at 04:59:26PM +0200, Christophe JAILLET wrote:
> If an error occurs after calling mux_state_select(), mux_state_deselect()
> should be called as already done in the remove function.
>
> Fixes: b6ef830c60b6 ("i2c: omap: Add support for setting mux")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
merged to i2c/i2c-host-fixes. Thanks!
> ---
> I'm not 100% sure of the error handling path.
>
> Should pm_runtime_dont_use_autosuspend() be called after the err_disable_pm
> label? (to match the calling order)
Yes, I think you are right here.
> Also, should errors from omap_i2c_init() be handled?
Yes, if it fails it should be handled.
Thanks for the two reports. Do you have time to fix them or
can I go ahead and do it?
Thanks,
Andi
Le 26/06/2025 à 00:10, Andi Shyti a écrit :
> Hi Christophe,
>
> On Sat, Jun 14, 2025 at 04:59:26PM +0200, Christophe JAILLET wrote:
>> If an error occurs after calling mux_state_select(), mux_state_deselect()
>> should be called as already done in the remove function.
>>
>> Fixes: b6ef830c60b6 ("i2c: omap: Add support for setting mux")
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>
> merged to i2c/i2c-host-fixes. Thanks!
>
>> ---
>> I'm not 100% sure of the error handling path.
>>
>> Should pm_runtime_dont_use_autosuspend() be called after the err_disable_pm
>> label? (to match the calling order)
>
> Yes, I think you are right here.
>
>> Also, should errors from omap_i2c_init() be handled?
>
> Yes, if it fails it should be handled.
>
> Thanks for the two reports. Do you have time to fix them or
> can I go ahead and do it?
I've sent a patch for each issue.
Feel free to take the lead if not correct. As said in the cover letter,
I'm not completely confident with them.
CJ
>
> Thanks,
> Andi
>
>
© 2016 - 2026 Red Hat, Inc.