All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] iio: adc: adi-axi-adc: Fix object reference counting
@ 2020-07-01 12:04 Nuno Sá
  2020-07-01 12:04 ` [PATCH 2/2] iio: adc: adi-axi-adc: Remove unneeded check Nuno Sá
  2020-07-01 14:07 ` [PATCH 1/2] iio: adc: adi-axi-adc: Fix object reference counting Ardelean, Alexandru
  0 siblings, 2 replies; 5+ messages in thread
From: Nuno Sá @ 2020-07-01 12:04 UTC (permalink / raw)
  To: linux-iio
  Cc: Lars-Peter Clausen, Peter Meerwald-Stadler, Hartmut Knaack,
	Jonathan Cameron, Michael Hennerich, Alexandru Ardelean

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á <nuno.sa@analog.com>
---
 drivers/iio/adc/adi-axi-adc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c
index 63d926e86798..86b6b65916ee 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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-07-04 16:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-01 12:04 [PATCH 1/2] iio: adc: adi-axi-adc: Fix object reference counting Nuno Sá
2020-07-01 12:04 ` [PATCH 2/2] iio: adc: adi-axi-adc: Remove unneeded check Nuno Sá
2020-07-01 13:57   ` Ardelean, Alexandru
2020-07-01 14:07 ` [PATCH 1/2] iio: adc: adi-axi-adc: Fix object reference counting Ardelean, Alexandru
2020-07-04 16:06   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.