]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: dac: mcp4725: Fix i2c_master_send() return value handling
authorMarek Vasut <marex@denx.de>
Thu, 11 May 2023 00:43:30 +0000 (02:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Jun 2023 08:28:59 +0000 (10:28 +0200)
commita87236446a62f4f62d9484804440bc7ba796d620
tree3d46cbcfce046146f8484bf7c8f520be703127d6
parentc3b25245e3a83a733bdabd66f62fd07f8a461cca
iio: dac: mcp4725: Fix i2c_master_send() return value handling

commit 09d3bec7009186bdba77039df01e5834788b3f95 upstream.

The i2c_master_send() returns number of sent bytes on success,
or negative on error. The suspend/resume callbacks expect zero
on success and non-zero on error. Adapt the return value of the
i2c_master_send() to the expectation of the suspend and resume
callbacks, including proper validation of the return value.

Fixes: cf35ad61aca2 ("iio: add mcp4725 I2C DAC driver")
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230511004330.206942-1-marex@denx.de
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/dac/mcp4725.c