Repository navigation
Commit 9e38e69
PCI: tegra: Fix OF node reference leak
Each iteration of for_each_child_of_node() executes of_node_put() on the
previous node, but in some return paths in the middle of the loop
of_node_put() is missing thus causing a reference leak.
Hence stash these mid-loop return values in a variable 'err' and add a
new label err_node_put which executes of_node_put() on the previous node
and returns 'err' on failure.
Change mid-loop return statements to point to jump to this label to
fix the reference leak.
Issue found with Coccinelle.
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
[lorenzo.pieralisi@arm.com: rewrote commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>1 parent 5f9e832 commit 9e38e69
1 file changed
Lines changed: 15 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2237 | 2237 | | |
2238 | 2238 | | |
2239 | 2239 | | |
2240 | | - | |
| 2240 | + | |
2241 | 2241 | | |
2242 | 2242 | | |
2243 | 2243 | | |
2244 | 2244 | | |
2245 | 2245 | | |
2246 | 2246 | | |
2247 | | - | |
| 2247 | + | |
| 2248 | + | |
2248 | 2249 | | |
2249 | 2250 | | |
2250 | 2251 | | |
| |||
2253 | 2254 | | |
2254 | 2255 | | |
2255 | 2256 | | |
2256 | | - | |
| 2257 | + | |
2257 | 2258 | | |
2258 | 2259 | | |
2259 | 2260 | | |
2260 | 2261 | | |
2261 | | - | |
| 2262 | + | |
| 2263 | + | |
2262 | 2264 | | |
2263 | 2265 | | |
2264 | 2266 | | |
| |||
2272 | 2274 | | |
2273 | 2275 | | |
2274 | 2276 | | |
2275 | | - | |
2276 | | - | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
2277 | 2281 | | |
2278 | 2282 | | |
2279 | 2283 | | |
2280 | 2284 | | |
2281 | | - | |
| 2285 | + | |
2282 | 2286 | | |
2283 | 2287 | | |
2284 | 2288 | | |
| |||
2330 | 2334 | | |
2331 | 2335 | | |
2332 | 2336 | | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
| 2340 | + | |
2333 | 2341 | | |
2334 | 2342 | | |
2335 | 2343 | | |
| |||
0 commit comments