diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2020-09-21 15:52:12 +0300 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2020-09-23 09:40:33 -0700 |
commit | 18360b33a071e5883250fd1e04bfdeff8c3887a3 (patch) | |
tree | 0541f24f0faa4d16576dd2aaa58b2e205842216a | |
parent | 6c094b31ea2ad773824362ba0fccb88d36f8d32d (diff) | |
download | linux-stable-18360b33a071e5883250fd1e04bfdeff8c3887a3.tar.gz linux-stable-18360b33a071e5883250fd1e04bfdeff8c3887a3.tar.bz2 linux-stable-18360b33a071e5883250fd1e04bfdeff8c3887a3.zip |
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: 266cd5835947 ("hwmon: (w83627ehf) convert to with_info interface")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Dr. David Alan Gilbert <linux@treblig.org>
Link: https://lore.kernel.org/r/20200921125212.GA1128194@mwanda
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r-- | drivers/hwmon/w83627ehf.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 5a5120121e50..3964ceab2817 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c @@ -1951,8 +1951,12 @@ static int w83627ehf_probe(struct platform_device *pdev) data, &w83627ehf_chip_info, 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: release_region(res->start, IOREGION_LENGTH); |