Skip to content

Commit e9c6004

Browse files
nunojsajic23
authored andcommitted
iio: adc: adi-axi-adc: Fix object reference counting
When looking for a registered client to attach with, the wrong reference counters are being grabbed. The idea is to increment the module and device counters of the client device and not the counters of the axi device being probed. Fixes: ef04070 (iio: adc: adi-axi-adc: add support for AXI ADC IP core) Signed-off-by: Nuno Sá <[email protected]> Acked-by: Alexandru Ardelean <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent d88de04 commit e9c6004

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,12 @@ static struct adi_axi_adc_client *adi_axi_adc_attach_client(struct device *dev)
332332
if (cl->dev->of_node != cln)
333333
continue;
334334

335-
if (!try_module_get(dev->driver->owner)) {
335+
if (!try_module_get(cl->dev->driver->owner)) {
336336
mutex_unlock(&registered_clients_lock);
337337
return ERR_PTR(-ENODEV);
338338
}
339339

340-
get_device(dev);
340+
get_device(cl->dev);
341341
cl->info = info;
342342
mutex_unlock(&registered_clients_lock);
343343
return cl;

0 commit comments

Comments
 (0)