From: Felix Gu <ustc.gu@gmail.com>
To: "Ariana Lazar" <ariana.lazar@microchip.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Felix Gu <ustc.gu@gmail.com>
Subject: [PATCH v2] iio: dac: mcp47feb02: Fix mutex used before initialization
Date: Wed, 25 Feb 2026 22:48:57 +0800 [thread overview]
Message-ID: <20260225-mcp47feb02-v2-1-4792dc3942d9@gmail.com> (raw)
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>
next reply other threads:[~2026-02-25 14:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 14:48 Felix Gu [this message]
2026-02-25 15:59 ` [PATCH v2] iio: dac: mcp47feb02: Fix mutex used before initialization 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260225-mcp47feb02-v2-1-4792dc3942d9@gmail.com \
--to=ustc.gu@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=andy@kernel.org \
--cc=ariana.lazar@microchip.com \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox