ASoC: rsnd: tidyup rsnd_io_to_runtime() macro
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 27 Nov 2014 08:06:25 +0000 (08:06 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 3 Dec 2014 18:51:40 +0000 (18:51 +0000)
Avoid NULL pointer access

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sh/rcar/rsnd.h

index 133ba1f44a86833320d90bbf68100f890a5e4795..5826c8abf7949d3ed1807dfe1c61a7fa8a219f84 100644 (file)
@@ -303,7 +303,8 @@ struct rsnd_dai *rsnd_dai_get(struct rsnd_priv *priv, int id);
 int rsnd_dai_is_play(struct rsnd_dai *rdai, struct rsnd_dai_stream *io);
 int rsnd_dai_id(struct rsnd_priv *priv, struct rsnd_dai *rdai);
 #define rsnd_dai_get_platform_info(rdai) ((rdai)->info)
-#define rsnd_io_to_runtime(io) ((io)->substream->runtime)
+#define rsnd_io_to_runtime(io) ((io)->substream ? \
+                               (io)->substream->runtime : NULL)
 
 void rsnd_dai_pointer_update(struct rsnd_dai_stream *io, int cnt);
 int rsnd_dai_pointer_offset(struct rsnd_dai_stream *io, int additional);