[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201027135457.968737032@linuxfoundation.org>
Date: Tue, 27 Oct 2020 14:46:47 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Dan Carpenter <dan.carpenter@...cle.com>,
"Dr. David Alan Gilbert" <linux@...blig.org>,
Guenter Roeck <linux@...ck-us.net>,
Sasha Levin <sashal@...nel.org>
Subject: [PATCH 5.9 157/757] hwmon: (w83627ehf) Fix a resource leak in probe
From: Dan Carpenter <dan.carpenter@...cle.com>
[ Upstream commit 18360b33a071e5883250fd1e04bfdeff8c3887a3 ]
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@...cle.com>
Reviewed-by: Dr. David Alan Gilbert <linux@...blig.org>
Link: https://lore.kernel.org/r/20200921125212.GA1128194@mwanda
Signed-off-by: Guenter Roeck <linux@...ck-us.net>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/hwmon/w83627ehf.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index 5a5120121e507..3964ceab2817c 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);
--
2.25.1
Powered by blists - more mailing lists