]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: light: al3010: Fix an error handling path in al3010_probe()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Tue, 10 Sep 2024 18:36:06 +0000 (20:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:51:10 +0000 (19:51 +0100)
commitbc2dbad38537f88b94210bccc490b9621d8ebc38
treedec7c53c7bb0674e43c76abe549ed81b1482d21d
parent2dcc86fefe09ac853158afd96b60d544af115dc5
iio: light: al3010: Fix an error handling path in al3010_probe()

[ Upstream commit a4b7064d34186cf4970fe0333c3b27346cf8f819 ]

If i2c_smbus_write_byte_data() fails in al3010_init(),
al3010_set_pwr(false) is not called.

In order to avoid such a situation, move the devm_add_action_or_reset()
witch calls al3010_set_pwr(false) right after a successful
al3010_set_pwr(true).

Fixes: c36b5195ab70 ("iio: light: add Dyna-Image AL3010 driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://patch.msgid.link/ee5d10a2dd2b70f29772d5df33774d3974a80f30.1725993353.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/light/al3010.c