[PATCH 4/6] ASoC: aw88166: check chip ID at probe
From: Marco Giunta
Date: Thu Nov 26 2026 - 16:29:18 EST
aw88166_init() reads the chip ID register but never compares the value
with AW88166_CHIP_ID, so probe continues on any device that answers
the read. Reject unknown IDs with -ENXIO, as aw88399 and aw88261 do,
and log the chip ID at debug level when the check passes.
Fixes: 94e412c28e61 ("ASoC: codecs: Add aw88166 amplifier driver")
Signed-off-by: Marco Giunta <marco_giunta@xxxxxxxxxx>
---
sound/soc/codecs/aw88166.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/soc/codecs/aw88166.c b/sound/soc/codecs/aw88166.c
index 5e891bf99bff..92034c90d8d7 100644
--- a/sound/soc/codecs/aw88166.c
+++ b/sound/soc/codecs/aw88166.c
@@ -1734,6 +1734,11 @@ static int aw88166_init(struct aw88166 *aw88166, struct i2c_client *i2c, struct
dev_err(&i2c->dev, "%s read chipid error. ret = %d\n", __func__, ret);
return ret;
}
+ if (chip_id != AW88166_CHIP_ID) {
+ dev_err(&i2c->dev, "unsupported chip ID 0x%04x\n", chip_id);
+ return -ENXIO;
+ }
+ dev_dbg(&i2c->dev, "chip ID 0x%04x\n", chip_id);
aw_dev = devm_kzalloc_obj(&i2c->dev, *aw_dev);
if (!aw_dev)
--
2.56.1