hwmon: (w83627ehf) Fix a resource leak in probe
Subsystems (2)
PATCH 1/1 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 <[email protected]>
--- drivers/hwmon/w83627ehf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/hwmon/w83627ehf.c +5 -1
@@ -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 );
Signature · 1 line
2.28.0
Quoted 9 lines · * Dan Carpenter ([email protected]) wrote:
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 <[email protected]>
Yeh that looks right to me; thanks!
Reviewed-by Dr. David Alan Gilbert <[email protected]>
Quoted 25 lines
--- drivers/hwmon/w83627ehf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/hwmon/w83627ehf.c +5
-1@@ -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 );Signature · 1 line
2.28.0
Signature · 4 lines
-----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ dave @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/
Quoted 10 lines · Dan Carpenter
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 <[email protected]>Reviewed-by Dr. David Alan Gilbert <[email protected]>
Applied.
Thanks,
Guenter
Quoted 22 lines
--- drivers/hwmon/w83627ehf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/hwmon/w83627ehf.c +5
-1@@ -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 );