From: "Dr. David Alan Gilbert" <linux@treblig.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jean Delvare <jdelvare@suse.com>,
Guenter Roeck <linux@roeck-us.net>,
linux-hwmon@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] hwmon: (w83627ehf) Fix a resource leak in probe
Date: Mon, 21 Sep 2020 16:48:16 +0000 [thread overview]
Message-ID: <20200921164816.GA15497@gallifrey> (raw)
In-Reply-To: <20200921125212.GA1128194@mwanda>
* Dan Carpenter (dan.carpenter@oracle.com) 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 <dan.carpenter@oracle.com>
Yeh that looks right to me; thanks!
Reviewed-by: Dr. David Alan Gilbert <linux@treblig.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 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);
> --
> 2.28.0
>
--
-----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 |_______/
WARNING: multiple messages have this Message-ID (diff)
From: "Dr. David Alan Gilbert" <linux@treblig.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jean Delvare <jdelvare@suse.com>,
Guenter Roeck <linux@roeck-us.net>,
linux-hwmon@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] hwmon: (w83627ehf) Fix a resource leak in probe
Date: Mon, 21 Sep 2020 17:48:16 +0100 [thread overview]
Message-ID: <20200921164816.GA15497@gallifrey> (raw)
In-Reply-To: <20200921125212.GA1128194@mwanda>
* Dan Carpenter (dan.carpenter@oracle.com) 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 <dan.carpenter@oracle.com>
Yeh that looks right to me; thanks!
Reviewed-by: Dr. David Alan Gilbert <linux@treblig.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 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);
> --
> 2.28.0
>
--
-----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 |_______/
next prev parent reply other threads:[~2020-09-21 16:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-21 12:52 [PATCH] hwmon: (w83627ehf) Fix a resource leak in probe Dan Carpenter
2020-09-21 12:52 ` Dan Carpenter
2020-09-21 16:48 ` Dr. David Alan Gilbert [this message]
2020-09-21 16:48 ` Dr. David Alan Gilbert
2020-09-23 16:40 ` Guenter Roeck
2020-09-23 16:40 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200921164816.GA15497@gallifrey \
--to=linux@treblig.org \
--cc=dan.carpenter@oracle.com \
--cc=jdelvare@suse.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.