alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] ASoC: sst_platform: initialize module_name properly
@ 2011-04-06  2:20 Lu Guanqun
  2011-04-06  2:20 ` [PATCH 2/4] ASoC: sst_platform: free the resources on fail path Lu Guanqun
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Lu Guanqun @ 2011-04-06  2:20 UTC (permalink / raw)
  To: ALSA; +Cc: Koul Vinod, Mark Brown, Takashi Iwai, Harsha Priya, Liam Girdwood

module_name will be checked in register_sst_card.
It will fail to register sst card if it's not initialized.

Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
---
 sound/soc/mid-x86/sst_platform.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c
index ee2c224..bd9d928 100644
--- a/sound/soc/mid-x86/sst_platform.c
+++ b/sound/soc/mid-x86/sst_platform.c
@@ -247,6 +247,7 @@ static int sst_platform_open(struct snd_pcm_substream *substream)
 		return -ENOMEM;
 	}
 	stream->sstdrv_ops->vendor_id = MSIC_VENDOR_ID;
+	stream->sstdrv_ops->module_name = SST_CARD_NAMES;
 	/* registering with SST driver to get access to SST APIs to use */
 	ret_val = register_sst_card(stream->sstdrv_ops);
 	if (ret_val) {

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] ASoC: sst_platform: free the resources on fail path
  2011-04-06  2:20 [PATCH 1/4] ASoC: sst_platform: initialize module_name properly Lu Guanqun
@ 2011-04-06  2:20 ` Lu Guanqun
  2011-04-06  2:20 ` [PATCH 3/4] ASoC: sst_platform: unregister sst card when being closed Lu Guanqun
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Lu Guanqun @ 2011-04-06  2:20 UTC (permalink / raw)
  To: ALSA; +Cc: Koul Vinod, Mark Brown, Takashi Iwai, Harsha Priya, Liam Girdwood

Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
---
 sound/soc/mid-x86/sst_platform.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c
index bd9d928..848ad3c 100644
--- a/sound/soc/mid-x86/sst_platform.c
+++ b/sound/soc/mid-x86/sst_platform.c
@@ -252,6 +252,8 @@ static int sst_platform_open(struct snd_pcm_substream *substream)
 	ret_val = register_sst_card(stream->sstdrv_ops);
 	if (ret_val) {
 		pr_err("sst: sst card registration failed\n");
+		kfree(stream->sstdrv_ops);
+		kfree(stream);
 		return ret_val;
 	}
 	runtime->private_data = stream;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] ASoC: sst_platform: unregister sst card when being closed
  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 ` Lu Guanqun
  2011-04-06  2:20 ` [PATCH 4/4] sst: make register_sst_card more self-contained Lu Guanqun
  2011-04-06 14:16 ` [PATCH 1/4] ASoC: sst_platform: initialize module_name properly Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Lu Guanqun @ 2011-04-06  2:20 UTC (permalink / raw)
  To: ALSA; +Cc: Koul Vinod, Mark Brown, Takashi Iwai, Harsha Priya, Liam Girdwood

Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
---
 sound/soc/mid-x86/sst_platform.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c
index 848ad3c..9ba9414 100644
--- a/sound/soc/mid-x86/sst_platform.c
+++ b/sound/soc/mid-x86/sst_platform.c
@@ -271,6 +271,7 @@ static int sst_platform_close(struct snd_pcm_substream *substream)
 	str_id = stream->stream_info.str_id;
 	if (str_id)
 		ret_val = stream->sstdrv_ops->pcm_control->close(str_id);
+	unregister_sst_card(stream->sstdrv_ops);
 	kfree(stream->sstdrv_ops);
 	kfree(stream);
 	return ret_val;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] sst: make register_sst_card more self-contained
  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
  2011-04-06 14:16 ` [PATCH 1/4] ASoC: sst_platform: initialize module_name properly Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Lu Guanqun @ 2011-04-06  2:20 UTC (permalink / raw)
  To: ALSA; +Cc: Koul Vinod, Mark Brown, Takashi Iwai, Harsha Priya, Liam Girdwood

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;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/4] ASoC: sst_platform: initialize module_name properly
  2011-04-06  2:20 [PATCH 1/4] ASoC: sst_platform: initialize module_name properly Lu Guanqun
                   ` (2 preceding siblings ...)
  2011-04-06  2:20 ` [PATCH 4/4] sst: make register_sst_card more self-contained Lu Guanqun
@ 2011-04-06 14:16 ` Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2011-04-06 14:16 UTC (permalink / raw)
  To: Lu Guanqun; +Cc: ALSA, Koul Vinod, Takashi Iwai, Harsha Priya, Liam Girdwood

On Wed, Apr 06, 2011 at 10:20:26AM +0800, Lu Guanqun wrote:
> module_name will be checked in register_sst_card.
> It will fail to register sst card if it's not initialized.
> 
> Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>

Applied all, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-04-06 14:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 4/4] sst: make register_sst_card more self-contained Lu Guanqun
2011-04-06 14:16 ` [PATCH 1/4] ASoC: sst_platform: initialize module_name properly Mark Brown

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).