Re: [PATCH v3 2/6] thermal: of: Use scoped device node handling to simplify thermal_of_trips_init()

From: Krzysztof Kozlowski
Date: Thu Oct 10 2024 - 13:58:42 EST


On 08/10/2024 13:32, Jonathan Cameron wrote:
>> tt = kzalloc(sizeof(*tt) * count, GFP_KERNEL);
>> - if (!tt) {
>> - ret = -ENOMEM;
>> - goto out_of_node_put;
>> - }
>> + if (!tt)
>> + return ERR_PTR(-ENOMEM);
>>
>> *ntrips = count;
>>
>> @@ -127,15 +123,11 @@ static struct thermal_trip *thermal_of_trips_init(struct device_node *np, int *n
>> goto out_kfree;
>> }
>>
>> - of_node_put(trips);
>> -
>> return tt;
>>
>> out_kfree:
>> kfree(tt);
> May be worth a follow up to do __free(kfree) on this + a steal for the return.
> Then push the ntrips set until after the populate so it doesn't need resetting to 0.

That's good idea, I'll send v4 with a revised patch (dropping your RB here).

Best regards,
Krzysztof