]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.103/iio-light-fix-improper-return-value.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.103 / iio-light-fix-improper-return-value.patch
1 From foo@baz Tue Nov 28 10:56:34 CET 2017
2 From: Pan Bian <bianpan2016@163.com>
3 Date: Sat, 3 Dec 2016 17:24:17 +0800
4 Subject: iio: light: fix improper return value
5
6 From: Pan Bian <bianpan2016@163.com>
7
8
9 [ Upstream commit db4e5376d058af8924fafd0520a0942d92538d0e ]
10
11 In function cm3232_reg_init(), it returns 0 even if the last call to
12 i2c_smbus_write_byte_data() returns a negative value (indicates error).
13 As a result, the return value may be inconsistent with the execution
14 status, and the caller of cm3232_reg_init() will not be able to detect
15 the error. This patch fixes the bug.
16
17 Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188641
18
19 Signed-off-by: Pan Bian <bianpan2016@163.com>
20 Signed-off-by: Jonathan Cameron <jic23@kernel.org>
21 Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23 ---
24 drivers/iio/light/cm3232.c | 2 +-
25 1 file changed, 1 insertion(+), 1 deletion(-)
26
27 --- a/drivers/iio/light/cm3232.c
28 +++ b/drivers/iio/light/cm3232.c
29 @@ -119,7 +119,7 @@ static int cm3232_reg_init(struct cm3232
30 if (ret < 0)
31 dev_err(&chip->client->dev, "Error writing reg_cmd\n");
32
33 - return 0;
34 + return ret;
35 }
36
37 /**