* [PATCH 1/1] counter: intel-qep: Use devm_mutex_init()
@ 2026-05-20 11:18 Ilpo Järvinen
2026-05-20 11:41 ` Stepan Ionichev
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Ilpo Järvinen @ 2026-05-20 11:18 UTC (permalink / raw)
To: Ilpo Järvinen, William Breathitt Gray, Jonathan Cameron,
Raymond Tan, Felipe Balbi (Intel), linux-iio, linux-kernel
Cc: stable
intel_qep_probe() calls mutex_init() but lacks the pairing
mutex_destroy() calls. Convert to devm_mutex_init() which handles
cleanup automatically.
Fixes: b711f687a1c1 ("counter: Add support for Intel Quadrature Encoder Peripheral")
Cc: stable@vger.kernel.org
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/counter/intel-qep.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/counter/intel-qep.c b/drivers/counter/intel-qep.c
index c49c178056f4..816586893517 100644
--- a/drivers/counter/intel-qep.c
+++ b/drivers/counter/intel-qep.c
@@ -414,7 +414,9 @@ static int intel_qep_probe(struct pci_dev *pci, const struct pci_device_id *id)
qep->dev = dev;
qep->regs = regs;
- mutex_init(&qep->lock);
+ ret = devm_mutex_init(dev, &qep->lock);
+ if (ret)
+ return ret;
intel_qep_init(qep);
pci_set_drvdata(pci, qep);
base-commit: 1d5dcaa3bd65f2e8c9baa14a393d3a2dc5db7524
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] counter: intel-qep: Use devm_mutex_init()
2026-05-20 11:18 [PATCH 1/1] counter: intel-qep: Use devm_mutex_init() Ilpo Järvinen
@ 2026-05-20 11:41 ` Stepan Ionichev
2026-05-20 11:42 ` Joshua Crofts
2026-05-22 1:36 ` William Breathitt Gray
2 siblings, 0 replies; 5+ messages in thread
From: Stepan Ionichev @ 2026-05-20 11:41 UTC (permalink / raw)
To: ilpo.jarvinen
Cc: wbg, Jonathan.Cameron, raymond.tan, balbi, linux-iio,
linux-kernel, stable, Stepan Ionichev
Reviewed-by: Stepan Ionichev <sozdayvek@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] counter: intel-qep: Use devm_mutex_init()
2026-05-20 11:18 [PATCH 1/1] counter: intel-qep: Use devm_mutex_init() Ilpo Järvinen
2026-05-20 11:41 ` Stepan Ionichev
@ 2026-05-20 11:42 ` Joshua Crofts
2026-05-22 1:36 ` William Breathitt Gray
2 siblings, 0 replies; 5+ messages in thread
From: Joshua Crofts @ 2026-05-20 11:42 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: William Breathitt Gray, Jonathan Cameron, Raymond Tan,
Felipe Balbi (Intel), linux-iio, linux-kernel, stable
On Wed, 20 May 2026 at 13:25, Ilpo Järvinen
<ilpo.jarvinen@linux.intel.com> wrote:
>
> intel_qep_probe() calls mutex_init() but lacks the pairing
> mutex_destroy() calls. Convert to devm_mutex_init() which handles
> cleanup automatically.
>
> Fixes: b711f687a1c1 ("counter: Add support for Intel Quadrature Encoder Peripheral")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
> drivers/counter/intel-qep.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/counter/intel-qep.c b/drivers/counter/intel-qep.c
> index c49c178056f4..816586893517 100644
> --- a/drivers/counter/intel-qep.c
> +++ b/drivers/counter/intel-qep.c
> @@ -414,7 +414,9 @@ static int intel_qep_probe(struct pci_dev *pci, const struct pci_device_id *id)
>
> qep->dev = dev;
> qep->regs = regs;
> - mutex_init(&qep->lock);
> + ret = devm_mutex_init(dev, &qep->lock);
> + if (ret)
> + return ret;
Unless you're compiling with CONFIG_DEBUG_MUTEXES, mutex_destroy() is a
nop, so a solo mutex_init() call is okay. Nevertheless the devm_
counterpart makes
debugging easier.
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
--
Kind regards
CJD
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] counter: intel-qep: Use devm_mutex_init()
2026-05-20 11:18 [PATCH 1/1] counter: intel-qep: Use devm_mutex_init() Ilpo Järvinen
2026-05-20 11:41 ` Stepan Ionichev
2026-05-20 11:42 ` Joshua Crofts
@ 2026-05-22 1:36 ` William Breathitt Gray
2026-05-29 2:34 ` William Breathitt Gray
2 siblings, 1 reply; 5+ messages in thread
From: William Breathitt Gray @ 2026-05-22 1:36 UTC (permalink / raw)
To: Raymond Tan, Felipe Balbi (Intel), linux-iio, linux-kernel,
Jonathan Cameron, Ilpo Järvinen
Cc: William Breathitt Gray, stable
On Wed, 20 May 2026 14:18:12 +0300, Ilpo Järvinen wrote:
> intel_qep_probe() calls mutex_init() but lacks the pairing
> mutex_destroy() calls. Convert to devm_mutex_init() which handles
> cleanup automatically.
>
>
Applied, thanks!
[1/1] counter: intel-qep: Use devm_mutex_init()
commit: ff35c72101d1dc6793496ade9c1bc3d70dd27bdd
Best regards,
--
William Breathitt Gray <wbg@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] counter: intel-qep: Use devm_mutex_init()
2026-05-22 1:36 ` William Breathitt Gray
@ 2026-05-29 2:34 ` William Breathitt Gray
0 siblings, 0 replies; 5+ messages in thread
From: William Breathitt Gray @ 2026-05-29 2:34 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: William Breathitt Gray, Raymond Tan, Felipe Balbi (Intel),
linux-iio, linux-kernel, Jonathan Cameron, stable,
Stepan Ionichev, Joshua Crofts
On Fri, May 22, 2026 at 10:36:15AM +0900, William Breathitt Gray wrote:
>
> On Wed, 20 May 2026 14:18:12 +0300, Ilpo Järvinen wrote:
> > intel_qep_probe() calls mutex_init() but lacks the pairing
> > mutex_destroy() calls. Convert to devm_mutex_init() which handles
> > cleanup automatically.
> >
> >
>
> Applied, thanks!
>
> [1/1] counter: intel-qep: Use devm_mutex_init()
> commit: ff35c72101d1dc6793496ade9c1bc3d70dd27bdd
>
> Best regards,
> --
> William Breathitt Gray <wbg@kernel.org>
Hello Ilpo,
In a similar patch[^1], Jonathan made a good point that a Fixes tag may
not be appropriate for this patch when it only affects debug information
as Joshua pointed out[^2].
So I am going to treat this as an update patch to intel-qep rather than
a bug fix and remove the Fixes tag and stable@vger.kernel.org CC line
from the description. If you feel that this patch really should be
picked up by the stable trees, please let us know and we can discuss
further.
Thank you,
William Breathitt Gray
[^1] https://lore.kernel.org/all/20260527175513.0df47897@jic23-huawei/
[^2] https://lore.kernel.org/all/CALoEA-wrYjbkhM7EiS+f-JjXShpRJw+gqy2zzymq9Ue5t-XN5A@mail.gmail.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-05-29 2:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-20 11:18 [PATCH 1/1] counter: intel-qep: Use devm_mutex_init() Ilpo Järvinen
2026-05-20 11:41 ` Stepan Ionichev
2026-05-20 11:42 ` Joshua Crofts
2026-05-22 1:36 ` William Breathitt Gray
2026-05-29 2:34 ` William Breathitt Gray
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox