[alsa-devel] [PATCH] ASoC: Intel: Check ops before we derefference pointers.

Jie Yang yang.jie at intel.com
Wed Jul 30 14:18:32 CEST 2014


From: Liam Girdwood <liam.r.girdwood at linux.intel.com>

Check ops pointer members before we can derefference them.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
Signed-off-by: Jie Yang <yang.jie at intel.com>
---
 sound/soc/intel/sst-dsp.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sound/soc/intel/sst-dsp.c b/sound/soc/intel/sst-dsp.c
index 0b715b2..cd23060 100644
--- a/sound/soc/intel/sst-dsp.c
+++ b/sound/soc/intel/sst-dsp.c
@@ -224,19 +224,23 @@ EXPORT_SYMBOL_GPL(sst_dsp_shim_update_bits64);
 
 void sst_dsp_dump(struct sst_dsp *sst)
 {
-	sst->ops->dump(sst);
+	if (sst->ops->dump)
+		sst->ops->dump(sst);
 }
 EXPORT_SYMBOL_GPL(sst_dsp_dump);
 
 void sst_dsp_reset(struct sst_dsp *sst)
 {
-	sst->ops->reset(sst);
+	if (sst->ops->reset)
+		sst->ops->reset(sst);
 }
 EXPORT_SYMBOL_GPL(sst_dsp_reset);
 
 int sst_dsp_boot(struct sst_dsp *sst)
 {
-	sst->ops->boot(sst);
+	if (sst->ops->boot)
+		sst->ops->boot(sst);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(sst_dsp_boot);
-- 
1.8.3.2



More information about the Alsa-devel mailing list