diff mbox

[for-4.11] ASoC: don't dereference NULL pcm_{new, free}

Message ID 87a88pj105.wl%kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kuninori Morimoto March 13, 2017, 3:46 a.m. UTC
Hi Brian

Thank you for your feedback

> There are 4 drivers calling that:
> 
>   snd_soc_dummy_probe
>   rt5514_spi_probe
>   2 instances of snd_dmaengine_pcm_register, via rockchip_i2s_probe
> 
> Only the latter two seem to run the assignment here:
> 
> 	if (platform_drv->pcm_new)
> 		platform->component.pcm_new = snd_soc_platform_drv_pcm_new;
> 
> Both snd_soc_dummy_probe and rt5514_spi_probe find ->pcm_new NULL here.

Hmm...

The crasher was snd_dmaengine_pcm_register's platform ?
This means, in your current kernel, dmaengine platform dosn't call
its .pcm_new (= dmaengine_pcm_new) somehow ?

I'm wondering why ->pcm_new became NULL which exists on probe timing ?
Can you check component and driver by this patch ?
This is very rough but enough for debug

---------------------
---------------------

Comments

Kuninori Morimoto March 14, 2017, 1:07 a.m. UTC | #1
Hi Brian

> > The crasher was snd_dmaengine_pcm_register's platform ?
> 
> No, actually it wasn't. It was spi2.0, which was a dummy, from
> snd_soc_dummy_probe(). But somehow snd_soc_platform_drv_pcm_new() got
> called for it...

Hmm.. I couldn't reproduce your issue on my system with dummy platform.
And your log is indicating something is happening which shouldn't happen.

Best regards
---
Kuninori Morimoto
diff mbox

Patch

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 5933851..43da1ec 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3322,6 +3322,10 @@  static int snd_soc_platform_drv_pcm_new(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_soc_platform *platform = rtd->platform;
 
+	printk("-------use name: %s, %p\n",
+	       platform->component.name,
+	       platform->driver);
+
 	return platform->driver->pcm_new(rtd);
 }
 
@@ -3356,8 +3360,12 @@  int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
 		platform->component.probe = snd_soc_platform_drv_probe;
 	if (platform_drv->remove)
 		platform->component.remove = snd_soc_platform_drv_remove;
-	if (platform_drv->pcm_new)
+	if (platform_drv->pcm_new) {
+		printk("-------add name: %s, %p\n",
+		       platform->component.name,
+		       platform->driver);
 		platform->component.pcm_new = snd_soc_platform_drv_pcm_new;
+	}
 	if (platform_drv->pcm_free)
 		platform->component.pcm_free = snd_soc_platform_drv_pcm_free;