ASoC: Intel: Skylake: Fix the NULL pointer exception in dsp_clean up
authorDharageswari.R <dharageswari.r@intel.com>
Thu, 28 Apr 2016 13:15:25 +0000 (18:45 +0530)
committerMark Brown <broonie@kernel.org>
Mon, 2 May 2016 11:02:17 +0000 (12:02 +0100)
If request firmware fails at init, the code loader DMA allocation
can be NULL, so check for boot complete before freeing up these
resources

Signed-off-by: Dharageswari R <dharageswari.r@intel.com>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/skylake/skl-sst-dsp.c
sound/soc/intel/skylake/skl-sst.c

index 2962ef22fc84bf4d018505bfa8c0cc3b86f46f3c..13c19855ee1ac0cd57473fd2fa2f122b65d58b2f 100644 (file)
@@ -336,8 +336,6 @@ void skl_dsp_free(struct sst_dsp *dsp)
        skl_ipc_int_disable(dsp);
 
        free_irq(dsp->irq, dsp);
-       dsp->cl_dev.ops.cl_cleanup_controller(dsp);
-       skl_cldma_int_disable(dsp);
        skl_ipc_op_int_disable(dsp);
        skl_ipc_int_disable(dsp);
 
index bec4a7c486fd7fd2453033bbeff918bc380155ed..13ec8d53b526d49e57c50e069fdc5ca076ec5fd1 100644 (file)
@@ -454,6 +454,10 @@ void skl_sst_dsp_cleanup(struct device *dev, struct skl_sst *ctx)
        skl_clear_module_table(ctx->dsp);
        skl_ipc_free(&ctx->ipc);
        ctx->dsp->ops->free(ctx->dsp);
+       if (ctx->boot_complete) {
+               ctx->dsp->cl_dev.ops.cl_cleanup_controller(ctx->dsp);
+               skl_cldma_int_disable(ctx->dsp);
+       }
 }
 EXPORT_SYMBOL_GPL(skl_sst_dsp_cleanup);