Re: [PATCH 6.1 00/98] 6.1.117-rc1 review
From: Pavel Machek
Date: Thu Nov 28 2024 - 13:05:31 EST
Hi!
> Icenowy Zheng <uwu@xxxxxxxxxx>
> thermal/of: support thermal zones w/o trips subnode
This seems to introduce memory leak.
+++ b/drivers/thermal/thermal_of.c
@@ -238,18 +238,15 @@ static struct thermal_trip *thermal_of_trips_init(struct device_node *np
, int *n
...
trips = of_get_child_by_name(np, "trips");
- if (!trips) {
- pr_err("Failed to find 'trips' node\n");
- return ERR_PTR(-EINVAL);
- }
+ if (!trips)
+ return NULL;
count = of_get_child_count(trips);
- if (!count) {
- pr_err("No trip point defined\n");
- ret = -EINVAL;
- goto out_of_node_put;
- }
+ if (!count)
+ return NULL;
In the !count case, we still need to do the of_node_put, AFAICT.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Attachment:
signature.asc
Description: PGP signature