int tt_add_tz(void)
{
- struct tt_thermal_zone *tt_zone __free(kfree);
- struct tt_work *tt_work __free(kfree) = NULL;
int ret;
- tt_zone = kzalloc(sizeof(*tt_zone), GFP_KERNEL);
+ struct tt_thermal_zone *tt_zone __free(kfree) = kzalloc(sizeof(*tt_zone),
+ GFP_KERNEL);
if (!tt_zone)
return -ENOMEM;
- tt_work = kzalloc(sizeof(*tt_work), GFP_KERNEL);
+ struct tt_work *tt_work __free(kfree) = kzalloc(sizeof(*tt_work), GFP_KERNEL);
if (!tt_work)
return -ENOMEM;
int tt_del_tz(const char *arg)
{
- struct tt_work *tt_work __free(kfree) = NULL;
struct tt_thermal_zone *tt_zone, *aux;
int ret;
int id;
if (ret != 1)
return -EINVAL;
- tt_work = kzalloc(sizeof(*tt_work), GFP_KERNEL);
+ struct tt_work *tt_work __free(kfree) = kzalloc(sizeof(*tt_work), GFP_KERNEL);
if (!tt_work)
return -ENOMEM;
int tt_zone_add_trip(const char *arg)
{
- struct tt_thermal_zone *tt_zone __free(put_tt_zone) = NULL;
- struct tt_trip *tt_trip __free(kfree) = NULL;
- struct tt_work *tt_work __free(kfree);
int id;
- tt_work = kzalloc(sizeof(*tt_work), GFP_KERNEL);
+ struct tt_work *tt_work __free(kfree) = kzalloc(sizeof(*tt_work), GFP_KERNEL);
if (!tt_work)
return -ENOMEM;
- tt_trip = kzalloc(sizeof(*tt_trip), GFP_KERNEL);
+ struct tt_trip *tt_trip __free(kfree) = kzalloc(sizeof(*tt_trip), GFP_KERNEL);
if (!tt_trip)
return -ENOMEM;
- tt_zone = tt_get_tt_zone(arg);
+ struct tt_thermal_zone *tt_zone __free(put_tt_zone) = tt_get_tt_zone(arg);
if (IS_ERR(tt_zone))
return PTR_ERR(tt_zone);
static int tt_zone_register_tz(struct tt_thermal_zone *tt_zone)
{
- struct thermal_trip *trips __free(kfree) = NULL;
struct thermal_zone_device *tz;
struct tt_trip *tt_trip;
int i;
if (tt_zone->tz)
return -EINVAL;
- trips = kcalloc(tt_zone->num_trips, sizeof(*trips), GFP_KERNEL);
+ struct thermal_trip *trips __free(kfree) = kcalloc(tt_zone->num_trips,
+ sizeof(*trips), GFP_KERNEL);
if (!trips)
return -ENOMEM;
int tt_zone_reg(const char *arg)
{
- struct tt_thermal_zone *tt_zone __free(put_tt_zone);
-
- tt_zone = tt_get_tt_zone(arg);
+ struct tt_thermal_zone *tt_zone __free(put_tt_zone) = tt_get_tt_zone(arg);
if (IS_ERR(tt_zone))
return PTR_ERR(tt_zone);
int tt_zone_unreg(const char *arg)
{
- struct tt_thermal_zone *tt_zone __free(put_tt_zone);
-
- tt_zone = tt_get_tt_zone(arg);
+ struct tt_thermal_zone *tt_zone __free(put_tt_zone) = tt_get_tt_zone(arg);
if (IS_ERR(tt_zone))
return PTR_ERR(tt_zone);