fixup_codec_formats(&dai_drv[i].capture);
}
- /* register DAIs */
- ret = snd_soc_register_dais(dev, dai_drv, num_dai);
- if (ret < 0)
+ /* register any DAIs */
+ if (num_dai) {
+ ret = snd_soc_register_dais(dev, dai_drv, num_dai);
+ if (ret < 0)
goto error;
+ }
mutex_lock(&client_mutex);
list_add(&codec->list, &codec_list);
return;
found:
- for (i = 0; i < codec->num_dai; i++)
- snd_soc_unregister_dai(dev);
+ if (codec->num_dai)
+ for (i = 0; i < codec->num_dai; i++)
+ snd_soc_unregister_dai(dev);
mutex_lock(&client_mutex);
list_del(&codec->list);