Skip to content

Commit ecacb0b

Browse files
Wei Yongjungroeck
authored andcommitted
hwmon: fix error return code in abituguru_probe()
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent 159c8cd commit ecacb0b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

drivers/hwmon/abituguru.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,14 +1414,18 @@ static int abituguru_probe(struct platform_device *pdev)
14141414
pr_info("found Abit uGuru\n");
14151415

14161416
/* Register sysfs hooks */
1417-
for (i = 0; i < sysfs_attr_i; i++)
1418-
if (device_create_file(&pdev->dev,
1419-
&data->sysfs_attr[i].dev_attr))
1417+
for (i = 0; i < sysfs_attr_i; i++) {
1418+
res = device_create_file(&pdev->dev,
1419+
&data->sysfs_attr[i].dev_attr);
1420+
if (res)
14201421
goto abituguru_probe_error;
1421-
for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++)
1422-
if (device_create_file(&pdev->dev,
1423-
&abituguru_sysfs_attr[i].dev_attr))
1422+
}
1423+
for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++) {
1424+
res = device_create_file(&pdev->dev,
1425+
&abituguru_sysfs_attr[i].dev_attr);
1426+
if (res)
14241427
goto abituguru_probe_error;
1428+
}
14251429

14261430
data->hwmon_dev = hwmon_device_register(&pdev->dev);
14271431
if (!IS_ERR(data->hwmon_dev))

0 commit comments

Comments
 (0)