]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.0.80/hwmon-fix-error-return-code-in-abituguru_probe.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / releases / 3.0.80 / hwmon-fix-error-return-code-in-abituguru_probe.patch
1 From ecacb0b17c08fae89f65468727f0e4b8e91da4e1 Mon Sep 17 00:00:00 2001
2 From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
3 Date: Mon, 13 May 2013 14:01:43 +0800
4 Subject: hwmon: fix error return code in abituguru_probe()
5
6 From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
7
8 commit ecacb0b17c08fae89f65468727f0e4b8e91da4e1 upstream.
9
10 Fix to return a negative error code from the error handling
11 case instead of 0, as done elsewhere in this function.
12
13 Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
14 Signed-off-by: Guenter Roeck <linux@roeck-us.net>
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16
17 ---
18 drivers/hwmon/abituguru.c | 16 ++++++++++------
19 1 file changed, 10 insertions(+), 6 deletions(-)
20
21 --- a/drivers/hwmon/abituguru.c
22 +++ b/drivers/hwmon/abituguru.c
23 @@ -1280,14 +1280,18 @@ static int __devinit abituguru_probe(str
24 pr_info("found Abit uGuru\n");
25
26 /* Register sysfs hooks */
27 - for (i = 0; i < sysfs_attr_i; i++)
28 - if (device_create_file(&pdev->dev,
29 - &data->sysfs_attr[i].dev_attr))
30 + for (i = 0; i < sysfs_attr_i; i++) {
31 + res = device_create_file(&pdev->dev,
32 + &data->sysfs_attr[i].dev_attr);
33 + if (res)
34 goto abituguru_probe_error;
35 - for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++)
36 - if (device_create_file(&pdev->dev,
37 - &abituguru_sysfs_attr[i].dev_attr))
38 + }
39 + for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++) {
40 + res = device_create_file(&pdev->dev,
41 + &abituguru_sysfs_attr[i].dev_attr);
42 + if (res)
43 goto abituguru_probe_error;
44 + }
45
46 data->hwmon_dev = hwmon_device_register(&pdev->dev);
47 if (!IS_ERR(data->hwmon_dev))