alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Lu Guanqun <guanqun.lu@intel.com>
To: ALSA <alsa-devel@alsa-project.org>
Cc: Koul Vinod <vinod.koul@intel.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Takashi Iwai <tiwai@suse.de>,
	Harsha Priya <priya.harsha@intel.com>,
	Liam Girdwood <lrg@slimlogic.co.uk>
Subject: [PATCH 4/4] sst: make register_sst_card more self-contained
Date: Wed, 06 Apr 2011 10:20:42 +0800	[thread overview]
Message-ID: <20110406022042.28406.78049.stgit@localhost> (raw)
In-Reply-To: <20110406022026.28406.98577.stgit@localhost>

From: Lu Guanqun <guanqun.lu@intel.com>

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 <guanqun.lu@intel.com>
---
 .../staging/intel_sst/intel_sst_drv_interface.c    |    1 -
 drivers/staging/intel_sst/intelmid.c               |    1 +
 2 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/intel_sst/intel_sst_drv_interface.c b/drivers/staging/intel_sst/intel_sst_drv_interface.c
index ea8e251..cf10dd6 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 fb22921..1fb39d4 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;

  parent reply	other threads:[~2011-04-06  2:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-06  2:20 [PATCH 1/4] ASoC: sst_platform: initialize module_name properly Lu Guanqun
2011-04-06  2:20 ` [PATCH 2/4] ASoC: sst_platform: free the resources on fail path Lu Guanqun
2011-04-06  2:20 ` [PATCH 3/4] ASoC: sst_platform: unregister sst card when being closed Lu Guanqun
2011-04-06  2:20 ` Lu Guanqun [this message]
2011-04-06 14:16 ` [PATCH 1/4] ASoC: sst_platform: initialize module_name properly Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110406022042.28406.78049.stgit@localhost \
    --to=guanqun.lu@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=lrg@slimlogic.co.uk \
    --cc=priya.harsha@intel.com \
    --cc=tiwai@suse.de \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).