Hi
On 02/19/2014 09:15 AM, Takashi Iwai wrote:
At Wed, 19 Feb 2014 08:57:53 +0200, Jarkko Nikula wrote:
I felt it was needless to test NULL pointers here since release_firmware checks it directly and platform_device_unregister indirectly. Not in platform_device_unregister but when calling platform_device_del and platform_device_put there.
The problem is that it may contain ERR_PTR(xxx). You have to either clear to NULL in
if (IS_ERR(sst_acpi->pdev_pcm)) { dev_err(dev, "Cannot register device %s. Error %d\n", desc->drv_name, (int)PTR_ERR(sst_acpi->pdev_pcm)); sst_acpi->pdev_pcm = NULL; }
or check conditionally like
if (!IS_ERR_OR_NULL(sst_acpi->pdev_pcm)) platform_device_unregister(sst_acpi->pdev_pcm);
Maybe the former is better.
Oh yes and I'm even testing it with the IS_ERR and PTR_ERR. Why that knowledge did not carry to sst_acpi_remove... will fix.