[alsa-devel] ASoC: rsnd: fix sound route path when using SRC6/SRC9

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Wed May 17 03:32:24 CEST 2017


Hi Geert

> > @@ -70,16 +71,19 @@ static int rsnd_cmd_init(struct rsnd_mod *mod,
> >         } else {
> >                 struct rsnd_mod *src = rsnd_io_to_mod_src(io);
> >
> > -               u32 path[] = {
> > -                       [0] = 0x30000,
> > -                       [1] = 0x30001,
> > -                       [2] = 0x40000,
> > -                       [3] = 0x10000,
> > -                       [4] = 0x20000,
> > -                       [5] = 0x40100
> > +               u8 cmd_case[] = {
> > +                       [0] = 0x3,
> > +                       [1] = 0x3,
> > +                       [2] = 0x4,
> > +                       [3] = 0x1,
> > +                       [4] = 0x2,
> > +                       [5] = 0x4,
> > +                       [6] = 0x1,
> > +                       [9] = 0x2,
> >                 };
> >
> > -               data = path[rsnd_mod_id(src)];
> > +               data = path[rsnd_mod_id(src)] |
> 
> With gcc 4.9.0:
> 
>     sound/soc/sh/rcar/cmd.c: In function 'rsnd_cmd_init':
>     sound/soc/sh/rcar/cmd.c:85:14: warning: array subscript is below
> array bounds [-Warray-bounds]
>        data = path[rsnd_mod_id(src)] |

Hmm....
I tried random code/compile, but gcc behavior seems strange.
Fore example if I removed next line, this warning disappeard

-		data = path[rsnd_mod_id(src)] |
-			cmd_case[rsnd_mod_id(src)] << 16;
+		data = path[rsnd_mod_id(src)];

Is this related to this ?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59124



Best regards
---
Kuninori Morimoto


More information about the Alsa-devel mailing list