Re: [PATCH v3 17/23] counter: intel-qep: Convert to new counter registration

From: Jarkko Nikula
Date: Thu Dec 30 2021 - 05:26:47 EST


On 12/29/21 17:44, Uwe Kleine-König wrote:
This fixes device lifetime issues where it was possible to free a live
struct device.

Fixes: b711f687a1c1 ("counter: Add support for Intel Quadrature Encoder Peripheral")
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
Acked-by: William Breathitt Gray <vilhelm.gray@xxxxxxxxx>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
---
drivers/counter/intel-qep.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)

Acked-by: Jarkko Nikula <jarkko.nikula@xxxxxxxxxxxxxxx>
Tested-by: Jarkko Nikula <jarkko.nikula@xxxxxxxxxxxxxxx>

Following test will cause an oops usually after a few iterations before this patch:

while :; do { sleep 5; echo bang; } > /dev/counter0 & sleep 1; echo 0000:00:18.4 >/sys/bus/pci/drivers/intel-qep/unbind; sleep 8; echo 0000:00:18.4 >/sys/bus/pci/drivers/intel-qep/bind; done