mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
ASoC: Intel: bytcr_rt5640: Fix invalid quirk input mapping
[ Upstream commit fba404e4b4af4f4f747bb0e41e9fff7d03c7bcc0 ]
When an invalid value is passed via quirk option, currently
bytcr_rt5640 driver only shows an error message but leaves as is.
This may lead to unepxected results like OOB access.
This patch corrects the input mapping to the certain default value if
an invalid value is passed.
Fixes: 063422ca2a ("ASoC: Intel: bytcr_rt5640: Set card long_name based on quirks")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Message-ID: <20250902171826.27329-3-tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
d75a561ba1
commit
29a41bf642
@@ -68,7 +68,8 @@ enum {
|
||||
BYT_RT5640_OVCD_SF_1P5 = (RT5640_OVCD_SF_1P5 << 13),
|
||||
};
|
||||
|
||||
#define BYT_RT5640_MAP(quirk) ((quirk) & GENMASK(3, 0))
|
||||
#define BYT_RT5640_MAP_MASK GENMASK(3, 0)
|
||||
#define BYT_RT5640_MAP(quirk) ((quirk) & BYT_RT5640_MAP_MASK)
|
||||
#define BYT_RT5640_JDSRC(quirk) (((quirk) & GENMASK(7, 4)) >> 4)
|
||||
#define BYT_RT5640_OVCD_TH(quirk) (((quirk) & GENMASK(12, 8)) >> 8)
|
||||
#define BYT_RT5640_OVCD_SF(quirk) (((quirk) & GENMASK(14, 13)) >> 13)
|
||||
@@ -140,7 +141,9 @@ static void log_quirks(struct device *dev)
|
||||
dev_info(dev, "quirk NO_INTERNAL_MIC_MAP enabled\n");
|
||||
break;
|
||||
default:
|
||||
dev_err(dev, "quirk map 0x%x is not supported, microphone input will not work\n", map);
|
||||
dev_warn_once(dev, "quirk sets invalid input map: 0x%x, default to DMIC1_MAP\n", map);
|
||||
byt_rt5640_quirk &= ~BYT_RT5640_MAP_MASK;
|
||||
byt_rt5640_quirk |= BYT_RT5640_DMIC1_MAP;
|
||||
break;
|
||||
}
|
||||
if (byt_rt5640_quirk & BYT_RT5640_HSMIC2_ON_IN1)
|
||||
|
||||
Reference in New Issue
Block a user