From: Eduardo Valentin <edubezval@gmail.com>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org
Subject: Re: [PATCH v1] Thermal/int340x: Fix memleak for aux trip
Date: Thu, 5 Mar 2015 01:57:02 -0400 [thread overview]
Message-ID: <20150305055700.GC3632@developer.hsd1.ca.comcast.net> (raw)
In-Reply-To: <1425330727-18854-2-git-send-email-srinivas.pandruvada@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2043 bytes --]
On Mon, Mar 02, 2015 at 01:12:07PM -0800, Srinivas Pandruvada wrote:
> When thermal zone device register fails or on module exit, the memory
> for aux_trip is not freed. This change fixes this issue.
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
applied into -fixes branch. Thanks.
> ---
> drivers/thermal/int340x_thermal/int340x_thermal_zone.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c
> index f88b088..1e25133 100644
> --- a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c
> +++ b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c
> @@ -208,7 +208,7 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
> trip_cnt, GFP_KERNEL);
> if (!int34x_thermal_zone->aux_trips) {
> ret = -ENOMEM;
> - goto free_mem;
> + goto err_trip_alloc;
> }
> trip_mask = BIT(trip_cnt) - 1;
> int34x_thermal_zone->aux_trip_nr = trip_cnt;
> @@ -248,14 +248,15 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
> 0, 0);
> if (IS_ERR(int34x_thermal_zone->zone)) {
> ret = PTR_ERR(int34x_thermal_zone->zone);
> - goto free_lpat;
> + goto err_thermal_zone;
> }
>
> return int34x_thermal_zone;
>
> -free_lpat:
> +err_thermal_zone:
> acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table);
> -free_mem:
> + kfree(int34x_thermal_zone->aux_trips);
> +err_trip_alloc:
> kfree(int34x_thermal_zone);
> return ERR_PTR(ret);
> }
> @@ -266,6 +267,7 @@ void int340x_thermal_zone_remove(struct int34x_thermal_zone
> {
> thermal_zone_device_unregister(int34x_thermal_zone->zone);
> acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table);
> + kfree(int34x_thermal_zone->aux_trips);
> kfree(int34x_thermal_zone);
> }
> EXPORT_SYMBOL_GPL(int340x_thermal_zone_remove);
> --
> 1.9.3
>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
prev parent reply other threads:[~2015-03-05 5:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-02 21:12 [PATCH v1] Thermal/int340x: Fix memleak for aux trip Srinivas Pandruvada
2015-03-02 21:12 ` Srinivas Pandruvada
2015-03-05 5:57 ` Eduardo Valentin [this message]
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=20150305055700.GC3632@developer.hsd1.ca.comcast.net \
--to=edubezval@gmail.com \
--cc=linux-pm@vger.kernel.org \
--cc=rui.zhang@intel.com \
--cc=srinivas.pandruvada@linux.intel.com \
/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.