From: Christophe JAILLET Date: Sun, 31 Jul 2022 09:55:27 +0000 (+0200) Subject: mfd: lp8788: Fix an error handling path in lp8788_probe() X-Git-Tag: baikal/mips/sdk5.8.2~2265 X-Git-Url: https://git.baikalelectronics.ru/?a=commitdiff_plain;h=2dd73bfec611f15faf7e8566fb047db554513c7b;p=kernel.git mfd: lp8788: Fix an error handling path in lp8788_probe() [ Upstream commit 4914d02b9e73131dd00feb000fa02c3359a4bb08 ] Should an error occurs in mfd_add_devices(), some resources need to be released, as already done in the .remove() function. Add an error handling path and a lp8788_irq_exit() call to undo a previous lp8788_irq_init(). Fixes: 591acb4f0ccc ("mfd: Add lp8788 mfd driver") Signed-off-by: Christophe JAILLET Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/18398722da9df9490722d853e4797350189ae79b.1659261275.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin --- diff --git a/drivers/mfd/lp8788.c b/drivers/mfd/lp8788.c index 768d556b3fe98..5c3d642c8e3a3 100644 --- a/drivers/mfd/lp8788.c +++ b/drivers/mfd/lp8788.c @@ -195,8 +195,16 @@ static int lp8788_probe(struct i2c_client *cl, const struct i2c_device_id *id) if (ret) return ret; - return mfd_add_devices(lp->dev, -1, lp8788_devs, - ARRAY_SIZE(lp8788_devs), NULL, 0, NULL); + ret = mfd_add_devices(lp->dev, -1, lp8788_devs, + ARRAY_SIZE(lp8788_devs), NULL, 0, NULL); + if (ret) + goto err_exit_irq; + + return 0; + +err_exit_irq: + lp8788_irq_exit(lp); + return ret; } static int lp8788_remove(struct i2c_client *cl)