public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mfd: lp8788: Fix an error handling path in lp8788_probe()
@ 2022-07-31  9:55 Christophe JAILLET
  2022-07-31  9:55 ` [PATCH 2/2] mfd: lp8788: Fix an error handling path in lp8788_irq_init() and lp8788_irq_init() Christophe JAILLET
  2022-08-10 11:16 ` [PATCH 1/2] mfd: lp8788: Fix an error handling path in lp8788_probe() Lee Jones
  0 siblings, 2 replies; 4+ messages in thread
From: Christophe JAILLET @ 2022-07-31  9:55 UTC (permalink / raw)
  To: Lee Jones, Samuel Ortiz, Milo Kim
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET

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: eea6b7cc53aa ("mfd: Add lp8788 mfd driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/mfd/lp8788.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/lp8788.c b/drivers/mfd/lp8788.c
index c223d2c6a363..998e8cc408a0 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)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-10 11:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-31  9:55 [PATCH 1/2] mfd: lp8788: Fix an error handling path in lp8788_probe() Christophe JAILLET
2022-07-31  9:55 ` [PATCH 2/2] mfd: lp8788: Fix an error handling path in lp8788_irq_init() and lp8788_irq_init() Christophe JAILLET
2022-08-10 11:17   ` Lee Jones
2022-08-10 11:16 ` [PATCH 1/2] mfd: lp8788: Fix an error handling path in lp8788_probe() Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox