soundwire: intel: fix error handling on dai registration issues
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Mon, 19 Sep 2022 17:57:11 +0000 (01:57 +0800)
committerVinod Koul <vkoul@kernel.org>
Tue, 20 Sep 2022 05:09:22 +0000 (10:39 +0530)
The call to intel_register_dai() may fail because of memory allocation
issues or problems reported by the ASoC core. In all cases, when a
error is thrown the component is not registered, it's invalid to
unregister it.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220919175721.354679-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/intel.c

index 01be62fa6c83829dc57b51e181996048dd4f66d8..3bb29bc00d5a5e9bee6c5bfc1e8b7914b57b73ee 100644 (file)
@@ -1432,7 +1432,6 @@ int intel_link_startup(struct auxiliary_device *auxdev)
        ret = intel_register_dai(sdw);
        if (ret) {
                dev_err(dev, "DAI registration failed: %d\n", ret);
-               snd_soc_unregister_component(dev);
                goto err_interrupt;
        }