mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 16:12:59 +02:00
ASoC: Intel: bytcr_rt5640: Fix invalid quirk input mapping
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>
This commit is contained in:
parent
b20eb0e8de
commit
fba404e4b4
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user