* [PATCH v2] iio: dac: mcp47feb02: Fix mutex used before initialization
@ 2026-02-25 14:48 Felix Gu
2026-02-25 15:59 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: Felix Gu @ 2026-02-25 14:48 UTC (permalink / raw)
To: Ariana Lazar, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko
Cc: Jonathan Cameron, linux-iio, linux-kernel, Felix Gu
The mcp47feb02_parse_fw() function uses data->lock, but the mutex was
initialized after this function in probe path.
Since mcp47feb02_parse_fw() is only called from probe(), remove the lock.
Fixes: bf394cc80369 ("iio: dac: adding support for Microchip MCP47FEB02")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
Changes in v2:
- Remove the lock in mcp47feb02_parse_fw() suggested by Nuno Sá.
- Link to v1: https://lore.kernel.org/r/20260223-mcp47feb02-v1-1-41f80bdbbb45@gmail.com
---
drivers/iio/dac/mcp47feb02.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/iio/dac/mcp47feb02.c b/drivers/iio/dac/mcp47feb02.c
index b218f0c3a0bd..08fb85359697 100644
--- a/drivers/iio/dac/mcp47feb02.c
+++ b/drivers/iio/dac/mcp47feb02.c
@@ -955,8 +955,6 @@ static int mcp47feb02_parse_fw(struct iio_dev *indio_dev,
u32 num_channels;
u8 chan_idx = 0;
- guard(mutex)(&data->lock);
-
num_channels = device_get_child_node_count(dev);
if (num_channels > chip_features->phys_channels)
return dev_err_probe(dev, -EINVAL, "More channels than the chip supports\n");
---
base-commit: d4906ae14a5f136ceb671bb14cedbf13fa560da6
change-id: 20260223-mcp47feb02-e0bed17e198b
Best regards,
--
Felix Gu <ustc.gu@gmail.com>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] iio: dac: mcp47feb02: Fix mutex used before initialization
2026-02-25 14:48 [PATCH v2] iio: dac: mcp47feb02: Fix mutex used before initialization Felix Gu
@ 2026-02-25 15:59 ` Andy Shevchenko
[not found] ` <CAN4SLj3jw-SqXSV04CA_-d=e=Mu63xaJuzu1rUYzTtt7myqMKw@mail.gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2026-02-25 15:59 UTC (permalink / raw)
To: Felix Gu
Cc: Ariana Lazar, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, Jonathan Cameron, linux-iio, linux-kernel
On Wed, Feb 25, 2026 at 10:48:57PM +0800, Felix Gu wrote:
> The mcp47feb02_parse_fw() function uses data->lock, but the mutex was
> initialized after this function in probe path.
>
> Since mcp47feb02_parse_fw() is only called from probe(), remove the lock.
But is it called early enough before anything that may trigger access to
'data'? Exempli gratia, IRQ handler in some cases may be triggered before
probe finished (is it the case here?).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] iio: dac: mcp47feb02: Fix mutex used before initialization
[not found] ` <CAN4SLj3jw-SqXSV04CA_-d=e=Mu63xaJuzu1rUYzTtt7myqMKw@mail.gmail.com>
@ 2026-02-26 13:18 ` Andy Shevchenko
2026-02-28 16:33 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2026-02-26 13:18 UTC (permalink / raw)
To: Felix Gu
Cc: Ariana Lazar, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, Jonathan Cameron, linux-iio, linux-kernel
On Thu, Feb 26, 2026 at 07:16:26PM +0800, Felix Gu wrote:
> > But is it called early enough before anything that may trigger access to
> > 'data'? Exempli gratia, IRQ handler in some cases may be triggered before
> > probe finished (is it the case here?).
> >
> I've checked the implementation, and this driver does not support IRQs.
Thanks for confirming!
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] iio: dac: mcp47feb02: Fix mutex used before initialization
2026-02-26 13:18 ` Andy Shevchenko
@ 2026-02-28 16:33 ` Jonathan Cameron
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2026-02-28 16:33 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Felix Gu, Ariana Lazar, David Lechner, Nuno Sá,
Andy Shevchenko, Jonathan Cameron, linux-iio, linux-kernel
On Thu, 26 Feb 2026 15:18:59 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> On Thu, Feb 26, 2026 at 07:16:26PM +0800, Felix Gu wrote:
> > > But is it called early enough before anything that may trigger access to
> > > 'data'? Exempli gratia, IRQ handler in some cases may be triggered before
> > > probe finished (is it the case here?).
> > >
> > I've checked the implementation, and this driver does not support IRQs.
>
> Thanks for confirming!
>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Applied.
Thanks,
Jonathan
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-28 16:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-25 14:48 [PATCH v2] iio: dac: mcp47feb02: Fix mutex used before initialization Felix Gu
2026-02-25 15:59 ` Andy Shevchenko
[not found] ` <CAN4SLj3jw-SqXSV04CA_-d=e=Mu63xaJuzu1rUYzTtt7myqMKw@mail.gmail.com>
2026-02-26 13:18 ` Andy Shevchenko
2026-02-28 16:33 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox