From: Jeffy Chen <jeffy.chen@rock-chips.com>
To: linux-kernel@vger.kernel.org
Cc: Jeffy Chen <jeffy.chen@rock-chips.com>,
Jaroslav Kysela <perex@perex.cz>,
alsa-devel@alsa-project.org, Heiko Stuebner <heiko@sntech.de>,
linux-rockchip@lists.infradead.org,
Mark Brown <broonie@kernel.org>, Takashi Iwai <tiwai@suse.com>,
Liam Girdwood <lgirdwood@gmail.com>,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ASoC: rockchip: Fix wrong allocation size of dapm routes
Date: Fri, 29 Sep 2017 11:52:52 +0800 [thread overview]
Message-ID: <20170929035252.19808-1-jeffy.chen@rock-chips.com> (raw)
The allocation size of dapm routes is wrong, correct it.
Fixes: d9f9c167edae ("ASoC: rockchip: Init dapm routes dynamically")
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
sound/soc/rockchip/rk3399_gru_sound.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c
index 30eed83e8a13..008452e55ef8 100644
--- a/sound/soc/rockchip/rk3399_gru_sound.c
+++ b/sound/soc/rockchip/rk3399_gru_sound.c
@@ -493,14 +493,18 @@ static int rockchip_sound_of_parse_dais(struct device *dev,
struct device_node *np_codec;
struct snd_soc_dai_link *dai;
struct snd_soc_dapm_route *routes;
- int i, index;
+ int i, index, max_num_routes;
card->dai_link = devm_kzalloc(dev, sizeof(rockchip_dais),
GFP_KERNEL);
if (!card->dai_link)
return -ENOMEM;
- routes = devm_kzalloc(dev, sizeof(rockchip_routes),
+ max_num_routes = 0;
+ for (i = 0; i < ARRAY_SIZE(rockchip_dais); i++)
+ max_num_routes += rockchip_routes[i].num_routes;
+
+ routes = devm_kzalloc(dev, max_num_routes * sizeof(*routes),
GFP_KERNEL);
if (!routes)
return -ENOMEM;
--
2.11.0
next reply other threads:[~2017-09-29 3:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-29 3:52 Jeffy Chen [this message]
2017-10-02 15:14 ` Doug Anderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170929035252.19808-1-jeffy.chen@rock-chips.com \
--to=jeffy.chen@rock-chips.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=heiko@sntech.de \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®