lkml.org 
[lkml]   [2018]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 01/10] mfd: da9063: Fix failpath in core
On Sat, 02 Jun 2018, Marek Vasut wrote:

> In case mfd_add_devices() fails, da9063_irq_exit() is not called to
> undo the IRQchip setup done by da9063_irq_init(). Fix this by adding
> the missing fail path.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Steve Twiss <stwiss.opensource@diasemi.com>
> Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Cc: linux-renesas-soc@vger.kernel.org
> ---
> V3: New patch
> ---
> drivers/mfd/da9063-core.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/da9063-core.c b/drivers/mfd/da9063-core.c
> index 6c2870d4e754..8226ebd8b96d 100644
> --- a/drivers/mfd/da9063-core.c
> +++ b/drivers/mfd/da9063-core.c
> @@ -229,10 +229,16 @@ int da9063_device_init(struct da9063 *da9063, unsigned int irq)
> ret = mfd_add_devices(da9063->dev, -1, da9063_devs,
> ARRAY_SIZE(da9063_devs), NULL, da9063->irq_base,
> NULL);
> - if (ret)
> + if (ret) {
> dev_err(da9063->dev, "Cannot add MFD cells\n");
> + goto err_irq_exit;
> + }
>
> return ret;
> +
> +err_irq_exit:
> + da9063_irq_exit(da9063);
> + return ret;
> }
>
> void da9063_device_exit(struct da9063 *da9063)

I haven't seen the later patches yet, so maybe the goto label expanded
on, but if it's not, then this would be better:

- if (ret)
+ if (ret) {
dev_err(da9063->dev, "Cannot add MFD cells\n");
+ da9063_irq_exit(da9063);
+ }

return ret;
}

--
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

\
 
 \ /
  Last update: 2018-06-04 14:25    [W:1.547 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site