iio: adc: rtq6056: Use automated cleanup for mode handling in write_raw
authorGabriel Schwartz <gschwartz@usp.br>
Fri, 26 Apr 2024 20:01:14 +0000 (17:01 -0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 29 Apr 2024 19:53:10 +0000 (20:53 +0100)
commit427298c632952709a33f3205d489ac496ae5b003
treee68e643bd650797bad3cf3505e2991d909112e72
parent0d8d62640763edfc11cc8568fe2115ad5af4e67e
iio: adc: rtq6056: Use automated cleanup for mode handling in write_raw

Using iio_device_claim_direct_scoped() to automate mode claim and release
simplifies code flow and allows for straight-forward error handling with
direct returns on errors.

Signed-off-by: Gabriel Schwartz <gschwartz@usp.br>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Reviewed-by: ChiYuan Huang <cy_huang@richtek.com>
Link: https://lore.kernel.org/r/20240426200118.20900-1-gschwartz@usp.br
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/rtq6056.c