summaryrefslogtreecommitdiffstats
path: root/sound/soc/sh/rcar/adg.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2018-09-06 05:21:33 +0200
committerMark Brown <broonie@kernel.org>2018-09-06 12:12:52 +0200
commit69235ccf491d2e26aefd465c0d3ccd1e3b2a9a9c (patch)
tree7e4c18d4919a0039d6b10093ec473e5d165e3f3a /sound/soc/sh/rcar/adg.c
parentASoC: uniphier: change status to orphan (diff)
downloadlinux-69235ccf491d2e26aefd465c0d3ccd1e3b2a9a9c.tar.xz
linux-69235ccf491d2e26aefd465c0d3ccd1e3b2a9a9c.zip
ASoC: rsnd: adg: care clock-frequency size
ADG has buffer over flow bug if DT has more than 3 clock-frequency. This patch fixup this issue, and uses first 2 values. clock-frequency = <x y>; /* this is OK */ clock-frequency = <x y z>; /* this is NG */ Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sh/rcar/adg.c')
-rw-r--r--sound/soc/sh/rcar/adg.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c
index 3a3064dda57f..051f96405346 100644
--- a/sound/soc/sh/rcar/adg.c
+++ b/sound/soc/sh/rcar/adg.c
@@ -462,6 +462,11 @@ static void rsnd_adg_get_clkout(struct rsnd_priv *priv,
goto rsnd_adg_get_clkout_end;
req_size = prop->length / sizeof(u32);
+ if (req_size > REQ_SIZE) {
+ dev_err(dev,
+ "too many clock-frequency, use top %d\n", REQ_SIZE);
+ req_size = REQ_SIZE;
+ }
of_property_read_u32_array(np, "clock-frequency", req_rate, req_size);
req_48kHz_rate = 0;