[alsa-devel] [PATCH 2/2] ASoC: imx-audmux: Check for NULL pointer

Fabio Estevam festevam at gmail.com
Thu Apr 5 14:45:52 CEST 2012


Check for NULL pointer before accessing it.

Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
---
 sound/soc/fsl/imx-audmux.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
index d467a1b..21d67bb 100644
--- a/sound/soc/fsl/imx-audmux.c
+++ b/sound/soc/fsl/imx-audmux.c
@@ -76,6 +76,9 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
 	if (audmux_clk)
 		clk_prepare_enable(audmux_clk);
 
+	if (!audmux_base)
+		return -ENOSYS;
+
 	ptcr = readl(audmux_base + IMX_AUDMUX_V2_PTCR(port));
 	pdcr = readl(audmux_base + IMX_AUDMUX_V2_PDCR(port));
 
-- 
1.7.1



More information about the Alsa-devel mailing list