@@ -109,12 +109,8 @@ static const struct regmap_config wm9705_regmap_config = {
};
static struct mfd_cell wm9705_cells[] = {
- {
- .name = "wm9705-codec",
- },
- {
- .name = "wm97xx-ts",
- },
+ { .name = "wm9705-codec", },
+ { .name = "wm97xx-ts", },
};
static bool wm9712_volatile_reg(struct device *dev, unsigned int reg)
@@ -181,12 +177,8 @@ static const struct regmap_config wm9712_regmap_config = {
};
static struct mfd_cell wm9712_cells[] = {
- {
- .name = "wm9712-codec",
- },
- {
- .name = "wm97xx-ts",
- },
+ { .name = "wm9712-codec", },
+ { .name = "wm97xx-ts", },
};
static const struct reg_default wm9713_reg_defaults[] = {
@@ -256,12 +248,8 @@ static const struct regmap_config wm9713_regmap_config = {
};
static struct mfd_cell wm9713_cells[] = {
- {
- .name = "wm9713-codec",
- },
- {
- .name = "wm97xx-ts",
- },
+ { .name = "wm9713-codec", },
+ { .name = "wm97xx-ts", },
};
static int wm97xx_ac97_probe(struct ac97_codec_device *adev)
@@ -270,7 +258,7 @@ static int wm97xx_ac97_probe(struct ac97_codec_device *adev)
const struct regmap_config *config;
struct wm97xx_platform_data *codec_pdata;
struct mfd_cell *cells;
- int ret = 0, nb_cells, i;
+ int ret = -ENODEV, nb_cells, i;
struct wm97xx_pdata *pdata = snd_ac97_codec_get_platdata(adev);
wm97xx = devm_kzalloc(ac97_codec_dev2dev(adev),
@@ -309,7 +297,7 @@ static int wm97xx_ac97_probe(struct ac97_codec_device *adev)
nb_cells = ARRAY_SIZE(wm9713_cells);
break;
default:
- config = NULL;
+ goto err_free_compat;
}
for (i = 0; i < nb_cells; i++) {
@@ -317,23 +305,22 @@ static int wm97xx_ac97_probe(struct ac97_codec_device *adev)
cells[i].pdata_size = sizeof(*codec_pdata);
}
- if (config) {
- codec_pdata->regmap =
- devm_regmap_init_ac97(wm97xx->ac97, config);
- if (IS_ERR(codec_pdata->regmap))
- ret = PTR_ERR(codec_pdata->regmap);
- } else {
- ret = -ENODEV;
+ codec_pdata->regmap = devm_regmap_init_ac97(wm97xx->ac97, config);
+ if (IS_ERR(codec_pdata->regmap)) {
+ ret = PTR_ERR(codec_pdata->regmap);
+ goto err_free_compat;
}
- if (!ret)
- ret = devm_mfd_add_devices(wm97xx->dev, PLATFORM_DEVID_NONE,
- cells, nb_cells, NULL, 0, NULL);
-
+ ret = devm_mfd_add_devices(wm97xx->dev, PLATFORM_DEVID_NONE,
+ cells, nb_cells, NULL, 0, NULL);
if (ret)
- snd_ac97_compat_release(wm97xx->ac97);
+ goto err_free_compat;
return ret;
+
+err_free_compat:
+ snd_ac97_compat_release(wm97xx->ac97);
+ return ret;
}
static int wm97xx_ac97_remove(struct ac97_codec_device *adev)
@@ -354,11 +354,14 @@ static int wm9705_soc_probe(struct snd_soc_codec *codec)
static int wm9705_soc_remove(struct snd_soc_codec *codec)
{
+#ifdef CONFIG_SND_SOC_AC97_BUS
struct wm9705_priv *wm9705 = snd_soc_codec_get_drvdata(codec);
- snd_soc_codec_exit_regmap(codec);
- if (!wm9705->mfd_pdata)
+ if (!wm9705->mfd_pdata) {
+ snd_soc_codec_exit_regmap(codec);
snd_soc_free_ac97_codec(wm9705->ac97);
+ }
+#endif
return 0;
}
@@ -674,11 +674,14 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec)
static int wm9712_soc_remove(struct snd_soc_codec *codec)
{
+#ifdef CONFIG_SND_SOC_AC97_BUS
struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec);
- snd_soc_codec_exit_regmap(codec);
- if (!wm9712->mfd_pdata)
+ if (!wm9712->mfd_pdata) {
+ snd_soc_codec_exit_regmap(codec);
snd_soc_free_ac97_codec(wm9712->ac97);
+ }
+#endif
return 0;
}
@@ -1238,14 +1238,14 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec)
static int wm9713_soc_remove(struct snd_soc_codec *codec)
{
+#ifdef CONFIG_SND_SOC_AC97_BUS
struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec);
if (!wm9713->mfd_pdata) {
snd_soc_codec_exit_regmap(codec);
-#ifdef CONFIG_SND_SOC_AC97_BUS
snd_soc_free_ac97_codec(wm9713->ac97);
-#endif
}
+#endif
return 0;
}