aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNuno Sá <[email protected]>2020-07-01 14:04:41 +0200
committerJonathan Cameron <[email protected]>2020-07-04 17:05:50 +0100
commite9c6004eef0019375e4b0339f1f88d9d6ed99018 (patch)
tree09d68b482e4f7e27815ac34baf4ca5373fef3e4e
parentd88de040e1df38414fc1e4380be9d0e997ab4d58 (diff)
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: ef04070692a2 (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]>
-rw-r--r--drivers/iio/adc/adi-axi-adc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c
index c24c8da99eb4..7af8f0510535 100644
--- a/drivers/iio/adc/adi-axi-adc.c
+++ b/drivers/iio/adc/adi-axi-adc.c
@@ -332,12 +332,12 @@ static struct adi_axi_adc_client *adi_axi_adc_attach_client(struct device *dev)
if (cl->dev->of_node != cln)
continue;
- if (!try_module_get(dev->driver->owner)) {
+ if (!try_module_get(cl->dev->driver->owner)) {
mutex_unlock(&registered_clients_lock);
return ERR_PTR(-ENODEV);
}
- get_device(dev);
+ get_device(cl->dev);
cl->info = info;
mutex_unlock(&registered_clients_lock);
return cl;