Commit 18360b33 authored by Dan Carpenter's avatar Dan Carpenter Committed by Guenter Roeck

hwmon: (w83627ehf) Fix a resource leak in probe

Smatch has a new check for resource leaks which found a bug in probe:

    drivers/hwmon/w83627ehf.c:2417 w83627ehf_probe()
    warn: 'res->start' not released on lines: 2412.

We need to clean up if devm_hwmon_device_register_with_info() fails.

Fixes: 266cd583 ("hwmon: (w83627ehf) convert to with_info interface")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarDr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20200921125212.GA1128194@mwandaSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 6c094b31
...@@ -1951,8 +1951,12 @@ static int w83627ehf_probe(struct platform_device *pdev) ...@@ -1951,8 +1951,12 @@ static int w83627ehf_probe(struct platform_device *pdev)
data, data,
&w83627ehf_chip_info, &w83627ehf_chip_info,
w83627ehf_groups); w83627ehf_groups);
if (IS_ERR(hwmon_dev)) {
err = PTR_ERR(hwmon_dev);
goto exit_release;
}
return PTR_ERR_OR_ZERO(hwmon_dev); return 0;
exit_release: exit_release:
release_region(res->start, IOREGION_LENGTH); release_region(res->start, IOREGION_LENGTH);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment