On Wed, 29 Jul 2020 17:03:22 +0200, Ranjani Sridharan wrote:
On Wed, 2020-07-29 at 09:48 +0200, Takashi Iwai wrote:
On Wed, 29 Jul 2020 01:10:11 +0200, Ranjani Sridharan wrote:
When the ASoC card registration fails and the codec component driver never probes, the codec device is not initialized and therefore memory for codec->wcaps is not allocated. This results in a NULL pointer dereference when the codec driver suspend callback is invoked during system suspend. Fix this by returning without performing any actions during codec suspend/resume if the card was not registered successfully.
Reviewed-by: Pierre-Louis Bossart < pierre-louis.bossart@linux.intel.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
The code changes look OK to apply, but I still wonder how the runtime PM gets invoked even if the device is not instantiated properly?
Hi Takashi,
Its not runtime PM suspend but rather the system PM suspend callback that is invoked when the system is suspended that ends up callling the the runtime PM callback. So, the sequence is: hda_codec_pm_suspend() -> pm_runtime_force_suspend() -> hda_codec_runtime_suspend()
OK, but the problem is still same. The basic problem is that the hda_codec_driver_probe() is called for the hda_codec object that hasn't been initialized and bypasses to ext_ops.hdev_attach.
So, we can factor out the fundamental part of snd_hda_codec_device_new() that is irrelevant with the card object and call it in hdac_hda_dev_probe(). Most of the legacy HD-audio codec can work without the card object, including suspend/resume.
But this will be a more intensive surgery, and maybe not much worth for the corner case, so I already applied your patch as is.
thanks,
Takashi