Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: light: al3320a: Fix an error handling path in al3320a_probe()

If regmap_write() fails in al3320a_init(), al3320a_set_pwr_off is
not called.

In order to avoid such a situation, move the devm_add_action_or_reset()
which calls al3320a_set_pwr_off right after a successful
al3320a_set_pwr_on.

Signed-off-by: David Heidelberg <david@ixit.cz>
Link: https://patch.msgid.link/20250402-al3010-iio-regmap-v4-3-d189bea87261@ixit.cz
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

David Heidelberg and committed by
Jonathan Cameron
b8154f34 c0461f8e

+6 -4
+6 -4
drivers/iio/light/al3320a.c
··· 101 101 if (ret < 0) 102 102 return ret; 103 103 104 + ret = devm_add_action_or_reset(&data->client->dev, 105 + al3320a_set_pwr_off, 106 + data); 107 + if (ret) 108 + return ret; 109 + 104 110 ret = i2c_smbus_write_byte_data(data->client, AL3320A_REG_CONFIG_RANGE, 105 111 FIELD_PREP(AL3320A_GAIN_MASK, 106 112 AL3320A_RANGE_3)); ··· 216 210 dev_err(dev, "al3320a chip init failed\n"); 217 211 return ret; 218 212 } 219 - 220 - ret = devm_add_action_or_reset(dev, al3320a_set_pwr_off, data); 221 - if (ret < 0) 222 - return ret; 223 213 224 214 return devm_iio_device_register(dev, indio_dev); 225 215 }