Skip to content

Commit ada7b0c

Browse files
Yuuoniyjic23
authored andcommitted
iio: adc: adi-axi-adc: Fix refcount leak in adi_axi_adc_attach_client
of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: ef04070 ("iio: adc: adi-axi-adc: add support for AXI ADC IP core") Signed-off-by: Miaoqian Lin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 7a2f6f6 commit ada7b0c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/iio/adc/adi-axi-adc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,16 +322,19 @@ static struct adi_axi_adc_client *adi_axi_adc_attach_client(struct device *dev)
322322

323323
if (!try_module_get(cl->dev->driver->owner)) {
324324
mutex_unlock(&registered_clients_lock);
325+
of_node_put(cln);
325326
return ERR_PTR(-ENODEV);
326327
}
327328

328329
get_device(cl->dev);
329330
cl->info = info;
330331
mutex_unlock(&registered_clients_lock);
332+
of_node_put(cln);
331333
return cl;
332334
}
333335

334336
mutex_unlock(&registered_clients_lock);
337+
of_node_put(cln);
335338

336339
return ERR_PTR(-EPROBE_DEFER);
337340
}

0 commit comments

Comments
 (0)