From: Lu Guanqun Date: Wed, 6 Apr 2011 02:20:42 +0000 (+0800) Subject: sst: make register_sst_card more self-contained X-Git-Tag: firefly_0821_release~7613^2~1326^2~458 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=31dea7385174596f4369f71c712f1d1006a3fa05;p=firefly-linux-kernel-4.4.55.git sst: make register_sst_card more self-contained register_sst_card is used in ASoC code with field `scard_ops` being NULL. Without this patch, there will be NULL dereference. Signed-off-by: Lu Guanqun Signed-off-by: Mark Brown Cc: Alan Cox Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/intel_sst/intel_sst_drv_interface.c b/drivers/staging/intel_sst/intel_sst_drv_interface.c index e9c182108243..971588ce26d3 100644 --- a/drivers/staging/intel_sst/intel_sst_drv_interface.c +++ b/drivers/staging/intel_sst/intel_sst_drv_interface.c @@ -508,7 +508,6 @@ int register_sst_card(struct intel_sst_card_ops *card) sst_drv_ctx->pmic_state = SND_MAD_INIT_DONE; sst_drv_ctx->rx_time_slot_status = 0; /*default AMIC*/ card->pcm_control = sst_pmic_ops.pcm_control; - sst_drv_ctx->scard_ops->card_status = SND_CARD_UN_INIT; return 0; } else { pr_err("strcmp fail %s\n", card->module_name); diff --git a/drivers/staging/intel_sst/intelmid.c b/drivers/staging/intel_sst/intelmid.c index d207636a7b6d..2d4b94a8aa9d 100644 --- a/drivers/staging/intel_sst/intelmid.c +++ b/drivers/staging/intel_sst/intelmid.c @@ -802,6 +802,7 @@ static int __devinit snd_intelmad_sst_register( pr_err("sst card registration failed\n"); return ret_val; } + sst_drv_ctx->scard_ops->card_status = SND_CARD_UN_INIT; sst_card_vendor_id = intelmaddata->sstdrv_ops->vendor_id; intelmaddata->pmic_status = PMIC_UNINIT;