(I'm so sorry!) Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

iio: light: apds9999: register standby action after enabling device

apds9999_init() called devm_add_action_or_reset() at the start of the function, before register configuration and before enabling the device via APDS9999_MAIN_CTRL_LS_EN. If register initialization failed during apds9999_init() (e.g. SMBus write failures on LS_MEAS_RATE or LS_GAIN), devm_add_action_or_reset() immediately triggered apds9999_standby(), writing to the control register on a device that failed initialization and was never enabled. Fix this by registering devm_add_action_or_reset() only after APDS9999_MAIN_CTRL_LS_EN is successfully written to the control register. Signed-off-by: Surendra Singh Chouhan <kr494167@gmail.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>


Author Surendra Singh Chouhan Committer Jonathan Cameron Date Commit Parent 575acf62
+6 -6
1 changed file
+6 -6
1 changed file