Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb7a3ca0 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Greg Kroah-Hartman
Browse files

mfd: lp8788: Fix an error handling path in lp8788_probe()



[ Upstream commit becfdcd75126b20b8ec10066c5e85b34f8994ad5 ]

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: eea6b7cc ("mfd: Add lp8788 mfd driver")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarLee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/18398722da9df9490722d853e4797350189ae79b.1659261275.git.christophe.jaillet@wanadoo.fr


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent acbed9e8
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -199,8 +199,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,
	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)