static int mv88fx_snd_probe(struct platform_device *pdev) { int ret = 0; mv88fx_snd_debug("mv88fx_snd_probe"); if (mv88fx_initalize_machine_data(pdev) != 0) goto error; mv88fx_machine_data.snd_dev = platform_device_alloc("soc-audio", 0); if (!mv88fx_machine_data.snd_dev) { ret = -ENOMEM; goto error; } if(machine_is_dove_avng_v3()) { platform_set_drvdata(mv88fx_machine_data.snd_dev, &mv88fx_snd_devdata_avd1_v3); mv88fx_snd_devdata_avd1_v3.dev = &mv88fx_machine_data.snd_dev->dev; } else { platform_set_drvdata(mv88fx_machine_data.snd_dev, &mv88fx_snd_devdata); mv88fx_snd_devdata.dev = &mv88fx_machine_data.snd_dev->dev; } mv88fx_machine_data.snd_dev->dev.platform_data = &mv88fx_machine_data; ret = platform_device_add(mv88fx_machine_data.snd_dev); if(ret) { platform_device_put(mv88fx_machine_data.snd_dev); } ret = platform_device_register(&rt5630_codec_dev); if(ret) platform_device_unregister(&rt5630_codec_dev); return ret; error: mv88fx_snd_error(""); #if defined(CONFIG_HAVE_CLK) if (!IS_ERR(mv88fx_machine_data.clk)) { clk_disable(mv88fx_machine_data.clk); clk_put(mv88fx_machine_data.clk); } #endif if (mv88fx_machine_data.snd_dev) platform_device_unregister(mv88fx_machine_data.snd_dev); return ret; }
static int mv88fx_snd_probe(struct platform_device *pdev) { int ret = 0; mv88fx_snd_debug(""); if (mv88fx_initalize_machine_data(pdev) != 0) goto error; mv88fx_machine_data.snd_dev = platform_device_alloc("soc-audio", 1); if (!mv88fx_machine_data.snd_dev) { ret = -ENOMEM; goto error; } platform_set_drvdata(mv88fx_machine_data.snd_dev, &mv88fx_snd_devdata); mv88fx_snd_devdata.dev = &mv88fx_machine_data.snd_dev->dev; mv88fx_machine_data.snd_dev->dev.platform_data = &mv88fx_machine_data; ret = platform_device_add(mv88fx_machine_data.snd_dev); mv88fx_snd_debug(""); return 0; error: mv88fx_snd_error(""); #if defined(CONFIG_HAVE_CLK) if (!IS_ERR(mv88fx_machine_data.clk)) { clk_disable(mv88fx_machine_data.clk); clk_put(mv88fx_machine_data.clk); } #endif if (mv88fx_machine_data.snd_dev) platform_device_unregister(mv88fx_machine_data.snd_dev); return ret; }