2022-07-31 12:01:27

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH] mfd: intel_soc_pmic: Fix an error handling path in intel_soc_pmic_i2c_probe()

The commit in Fixes: has added a pwm_add_table() call in the probe() and
a pwm_remove_table() call in the remove(), but forget to update the error
handling path of the probe.

Add the missing pwm_remove_table() call.

Fixes: a3aa9a93df9f ("mfd: intel_soc_pmic_core: ADD PWM lookup table for CRC PMIC based PWM")
Signed-off-by: Christophe JAILLET <[email protected]>
---
The order of pwm_remove_table() and regmap_del_irq_chip() is not the same
as the one in the remove function.
The one in this patch looks more logical to me because things are done in
the reverse order of allocations...

... but in regmap_del_irq_chip() there is irq, and in such a case releasing
resource is sometime tricky.

Review with care.
---
drivers/mfd/intel_soc_pmic_core.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c
index 5e8c94e008ed..85d070bce0e2 100644
--- a/drivers/mfd/intel_soc_pmic_core.c
+++ b/drivers/mfd/intel_soc_pmic_core.c
@@ -77,6 +77,7 @@ static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c,
return 0;

err_del_irq_chip:
+ pwm_remove_table(crc_pwm_lookup, ARRAY_SIZE(crc_pwm_lookup));
regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data);
return ret;
}
--
2.34.1



2022-07-31 20:02:38

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH] mfd: intel_soc_pmic: Fix an error handling path in intel_soc_pmic_i2c_probe()

On Sun, Jul 31, 2022 at 1:19 PM Christophe JAILLET
<[email protected]> wrote:
>
> The commit in Fixes: has added a pwm_add_table() call in the probe() and
> a pwm_remove_table() call in the remove(), but forget to update the error
> handling path of the probe.
>
> Add the missing pwm_remove_table() call.

...

I guess it should be rebased on top of [1] which I assume will go into v5.20...

[1]: https://lore.kernel.org/lkml/[email protected]/

--
With Best Regards,
Andy Shevchenko

2022-07-31 20:02:58

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH] mfd: intel_soc_pmic: Fix an error handling path in intel_soc_pmic_i2c_probe()

On Sun, Jul 31, 2022 at 9:37 PM Andy Shevchenko
<[email protected]> wrote:
> On Sun, Jul 31, 2022 at 1:19 PM Christophe JAILLET
> <[email protected]> wrote:
> >
> > The commit in Fixes: has added a pwm_add_table() call in the probe() and
> > a pwm_remove_table() call in the remove(), but forget to update the error
> > handling path of the probe.
> >
> > Add the missing pwm_remove_table() call.
>
> ...
>
> I guess it should be rebased on top of [1] which I assume will go into v5.20...
>
> [1]: https://lore.kernel.org/lkml/[email protected]/

...And now I realize that I have sent some BS there, heh...
I need to send a v2, so I will take your patch as a precursor.


--
With Best Regards,
Andy Shevchenko