mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
ASoC: rt5663: Handle device_property_read_u32_array error codes
[ Upstream commit2167c0b205] The return value of device_property_read_u32_array() is not always 0. To catch the exception in case that devm_kzalloc failed and the rt5663->imp_table was NULL, which caused the failure of device_property_read_u32_array. Fixes:450f0f6a8f("ASoC: rt5663: Add the manual offset field to compensate the DC offset") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Link: https://lore.kernel.org/r/20211215031550.70702-1-jiasheng@iscas.ac.cn 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
f252502b53
commit
0ec943aafc
@@ -3446,6 +3446,7 @@ static void rt5663_calibrate(struct rt5663_priv *rt5663)
|
||||
static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev)
|
||||
{
|
||||
int table_size;
|
||||
int ret;
|
||||
|
||||
device_property_read_u32(dev, "realtek,dc_offset_l_manual",
|
||||
&rt5663->pdata.dc_offset_l_manual);
|
||||
@@ -3462,9 +3463,11 @@ static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev)
|
||||
table_size = sizeof(struct impedance_mapping_table) *
|
||||
rt5663->pdata.impedance_sensing_num;
|
||||
rt5663->imp_table = devm_kzalloc(dev, table_size, GFP_KERNEL);
|
||||
device_property_read_u32_array(dev,
|
||||
ret = device_property_read_u32_array(dev,
|
||||
"realtek,impedance_sensing_table",
|
||||
(u32 *)rt5663->imp_table, table_size);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -3489,8 +3492,11 @@ static int rt5663_i2c_probe(struct i2c_client *i2c,
|
||||
|
||||
if (pdata)
|
||||
rt5663->pdata = *pdata;
|
||||
else
|
||||
rt5663_parse_dp(rt5663, &i2c->dev);
|
||||
else {
|
||||
ret = rt5663_parse_dp(rt5663, &i2c->dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
regmap = devm_regmap_init_i2c(i2c, &temp_regmap);
|
||||
if (IS_ERR(regmap)) {
|
||||
|
||||
Reference in New Issue
Block a user