* [PATCH] ASoC: rt5663: Handle device_property_read_u32_array error codes
@ 2021-12-15 3:15 Jiasheng Jiang
2021-12-15 18:14 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Jiasheng Jiang @ 2021-12-15 3:15 UTC (permalink / raw)
To: oder_chiou, lgirdwood, broonie, perex, tiwai
Cc: alsa-devel, linux-kernel, Jiasheng Jiang
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: 450f0f6a8fb4 ("ASoC: rt5663: Add the manual offset field to compensate the DC offset")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
sound/soc/codecs/rt5663.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c
index be9fc58ff681..ee09ccd448dc 100644
--- a/sound/soc/codecs/rt5663.c
+++ b/sound/soc/codecs/rt5663.c
@@ -3461,6 +3461,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);
@@ -3477,9 +3478,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;
@@ -3504,8 +3507,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;
+ }
for (i = 0; i < ARRAY_SIZE(rt5663->supplies); i++)
rt5663->supplies[i].supply = rt5663_supply_names[i];
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: rt5663: Handle device_property_read_u32_array error codes
2021-12-15 3:15 [PATCH] ASoC: rt5663: Handle device_property_read_u32_array error codes Jiasheng Jiang
@ 2021-12-15 18:14 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2021-12-15 18:14 UTC (permalink / raw)
To: oder_chiou, Jiasheng Jiang, lgirdwood, tiwai, perex
Cc: linux-kernel, alsa-devel
On Wed, 15 Dec 2021 11:15:50 +0800, Jiasheng Jiang wrote:
> 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.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: rt5663: Handle device_property_read_u32_array error codes
commit: 2167c0b205960607fb136b4bb3c556a62be1569a
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-15 18:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-15 3:15 [PATCH] ASoC: rt5663: Handle device_property_read_u32_array error codes Jiasheng Jiang
2021-12-15 18:14 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).