[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <523A19B3.2090908@ti.com>
Date: Wed, 18 Sep 2013 17:22:59 -0400
From: Eduardo Valentin <eduardo.valentin@...com>
To: Joe Perches <joe@...ches.com>
CC: Eduardo Valentin <eduardo.valentin@...com>,
<swarren@...dotorg.org>, <pawel.moll@....com>,
<mark.rutland@....com>, <ian.campbell@...rix.com>,
<rob.herring@...xeda.com>, <linux@...ck-us.net>,
<rui.zhang@...el.com>, <wni@...dia.com>, <grant.likely@...aro.org>,
<durgadoss.r@...el.com>, <lm-sensors@...sensors.org>,
<linux-kernel@...r.kernel.org>, <linux-pm@...r.kernel.org>
Subject: Re: [PATCHv5 02/16] drivers: thermal: introduce device tree parser
On 18-09-2013 17:04, Joe Perches wrote:
> On Wed, 2013-09-18 at 16:57 -0400, Eduardo Valentin wrote:
>> This patch introduces a device tree bindings for
>> describing the hardware thermal behavior and limits.
>> Also a parser to read and interpret the data and feed
>> it in the thermal framework is presented.
> []
>> +int __init of_parse_thermal_zones(void)
>> +{
>> + struct device_node *np, *child;
>> + struct __thermal_zone *tz;
>> + struct thermal_zone_device_ops *ops;
> []
>> + if (!ops)
>> + return -ENOMEM;
>> +
>> + tzp = kzalloc(sizeof(*tzp), GFP_KERNEL);
>> + if (!tzp)
>> + return -ENOMEM;
>
> leaking memory when ops && !tpz
Yeah, and if !ops too. I am reposting with proper kfreeing. I will be
rolling back the added thermal zones when there is an OOM situation too.
>
>> +
>> + /* No hwmon because there might be hwmon drivers registering */
>> + tzp->no_hwmon = true;
>> +
>> + zone = thermal_zone_device_register(child->name, tz->ntrips,
>> + 0, tz,
>> + ops, tzp,
>> + tz->passive_delay,
>> + tz->polling_delay);
>> + if (IS_ERR(zone))
>> + pr_err("Failed to build %s zone %ld\n", child->name,
>> + PTR_ERR(zone));
>> + }
>
> Still leaking memory if !zone no?
yeah. Will free them too.
>
>> +
>> + return 0;
>> +}
>
>
>
>
--
You have got to be excited about what you are doing. (L. Lamport)
Eduardo Valentin
Download attachment "signature.asc" of type "application/pgp-signature" (296 bytes)
Powered by blists - more mailing lists