summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/cs35l41-lib.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2022-04-05 12:29:12 +0300
committerMark Brown <broonie@kernel.org>2022-04-05 12:29:12 +0300
commit9a2c98418930c60e25b89a140c8b42a8cd6d84a6 (patch)
treebac0f7d760c299545b4abfb07e64f202fab6c73a /sound/soc/codecs/cs35l41-lib.c
parent66e384d86ff533b3352a1f897c6bc7bf7f1adafe (diff)
parent0b3d5d2e358ca6772fc3662fca27acb12a682fbf (diff)
downloadlinux-9a2c98418930c60e25b89a140c8b42a8cd6d84a6.tar.xz
ASoC: Pull in fixes
cs35l41 is getting some active work and conflicts, plus some of the fixes are needed for my testing. Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/cs35l41-lib.c')
-rw-r--r--sound/soc/codecs/cs35l41-lib.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/soc/codecs/cs35l41-lib.c b/sound/soc/codecs/cs35l41-lib.c
index 9aa2b8948c61..de022a53bdf3 100644
--- a/sound/soc/codecs/cs35l41-lib.c
+++ b/sound/soc/codecs/cs35l41-lib.c
@@ -831,12 +831,14 @@ int cs35l41_otp_unpack(struct device *dev, struct regmap *regmap)
GENMASK(bit_offset + otp_map[i].size - 33, 0)) <<
(32 - bit_offset);
bit_offset += otp_map[i].size - 32;
- } else {
+ } else if (bit_offset + otp_map[i].size - 1 >= 0) {
otp_val = (otp_mem[word_offset] &
GENMASK(bit_offset + otp_map[i].size - 1, bit_offset)
) >> bit_offset;
bit_offset += otp_map[i].size;
- }
+ } else /* both bit_offset and otp_map[i].size are 0 */
+ otp_val = 0;
+
bit_sum += otp_map[i].size;
if (bit_offset == 32) {