diff --git a/sound/soc/tegra-alt/tegra210_admaif_alt.c b/sound/soc/tegra-alt/tegra210_admaif_alt.c index 3a8a4c50..e53fa413 100644 --- a/sound/soc/tegra-alt/tegra210_admaif_alt.c +++ b/sound/soc/tegra-alt/tegra210_admaif_alt.c @@ -249,7 +249,9 @@ static int tegra210_admaif_suspend(struct device *dev) { struct tegra210_admaif *admaif = dev_get_drvdata(dev); - regcache_mark_dirty(admaif->regmap); + if (admaif) + regcache_mark_dirty(admaif->regmap); + return 0; } #endif @@ -801,8 +803,6 @@ static int tegra210_admaif_probe(struct platform_device *pdev) goto err; } - dev_set_drvdata(&pdev->dev, admaif); - admaif->refcnt = 0; admaif->soc_data = soc_data; @@ -921,6 +921,8 @@ static int tegra210_admaif_probe(struct platform_device *pdev) regmap_update_bits(admaif->regmap, TEGRA210_ADMAIF_GLOBAL_ENABLE, 1, 1); + dev_set_drvdata(&pdev->dev, admaif); + return 0; err_unregister_codec: diff --git a/sound/soc/tegra-alt/tegra210_adx_alt.c b/sound/soc/tegra-alt/tegra210_adx_alt.c index fb909f38..1b0701cb 100644 --- a/sound/soc/tegra-alt/tegra210_adx_alt.c +++ b/sound/soc/tegra-alt/tegra210_adx_alt.c @@ -279,7 +279,9 @@ static int tegra210_adx_suspend(struct device *dev) { struct tegra210_adx *adx = dev_get_drvdata(dev); - regcache_mark_dirty(adx->regmap); + if (adx) + regcache_mark_dirty(adx->regmap); + return 0; } #endif @@ -645,7 +647,6 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev) ret = -ENOMEM; goto err; } - dev_set_drvdata(&pdev->dev, adx); adx->soc_data = soc_data; @@ -704,6 +705,8 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev) goto err_suspend; } + dev_set_drvdata(&pdev->dev, adx); + return 0; err_suspend: diff --git a/sound/soc/tegra-alt/tegra210_afc_alt.c b/sound/soc/tegra-alt/tegra210_afc_alt.c index 945e29a8..411e136e 100644 --- a/sound/soc/tegra-alt/tegra210_afc_alt.c +++ b/sound/soc/tegra-alt/tegra210_afc_alt.c @@ -93,7 +93,9 @@ static int tegra210_afc_suspend(struct device *dev) { struct tegra210_afc *afc = dev_get_drvdata(dev); - regcache_mark_dirty(afc->regmap); + if (afc) + regcache_mark_dirty(afc->regmap); + return 0; } #endif @@ -393,7 +395,6 @@ static int tegra210_afc_platform_probe(struct platform_device *pdev) ret = -ENOMEM; goto err; } - dev_set_drvdata(&pdev->dev, afc); afc->soc_data = soc_data; @@ -458,6 +459,8 @@ static int tegra210_afc_platform_probe(struct platform_device *pdev) goto err_suspend; } + dev_set_drvdata(&pdev->dev, afc); + return 0; err_suspend: diff --git a/sound/soc/tegra-alt/tegra210_amx_alt.c b/sound/soc/tegra-alt/tegra210_amx_alt.c index 3189abc0..5d03d73f 100644 --- a/sound/soc/tegra-alt/tegra210_amx_alt.c +++ b/sound/soc/tegra-alt/tegra210_amx_alt.c @@ -306,7 +306,9 @@ static int tegra210_amx_suspend(struct device *dev) { struct tegra210_amx *amx = dev_get_drvdata(dev); - regcache_mark_dirty(amx->regmap); + if (amx) + regcache_mark_dirty(amx->regmap); + return 0; } #endif @@ -829,7 +831,6 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev) ret = -ENOMEM; goto err; } - dev_set_drvdata(&pdev->dev, amx); amx->soc_data = soc_data; memset(amx->map, 0, sizeof(amx->map)); @@ -890,6 +891,8 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev) goto err_suspend; } + dev_set_drvdata(&pdev->dev, amx); + return 0; err_suspend: diff --git a/sound/soc/tegra-alt/tegra210_dmic_alt.c b/sound/soc/tegra-alt/tegra210_dmic_alt.c index 1bde5216..0ddf81e3 100644 --- a/sound/soc/tegra-alt/tegra210_dmic_alt.c +++ b/sound/soc/tegra-alt/tegra210_dmic_alt.c @@ -112,7 +112,9 @@ static int tegra210_dmic_suspend(struct device *dev) { struct tegra210_dmic *dmic = dev_get_drvdata(dev); - regcache_mark_dirty(dmic->regmap); + if (dmic) + regcache_mark_dirty(dmic->regmap); + return 0; } #endif @@ -435,7 +437,6 @@ static int tegra210_dmic_platform_probe(struct platform_device *pdev) ret = -ENOMEM; goto err; } - dev_set_drvdata(&pdev->dev, dmic); dmic->soc_data = soc_data; @@ -525,6 +526,8 @@ static int tegra210_dmic_platform_probe(struct platform_device *pdev) if (of_property_read_string(np, "prod-name", &prod_name) == 0) tegra_pinctrl_config_prod(&pdev->dev, prod_name); + dev_set_drvdata(&pdev->dev, dmic); + return 0; err_suspend: diff --git a/sound/soc/tegra-alt/tegra210_i2s_alt.c b/sound/soc/tegra-alt/tegra210_i2s_alt.c index 3f8f352e..26c801f9 100644 --- a/sound/soc/tegra-alt/tegra210_i2s_alt.c +++ b/sound/soc/tegra-alt/tegra210_i2s_alt.c @@ -314,7 +314,9 @@ static int tegra210_i2s_suspend(struct device *dev) { struct tegra210_i2s *i2s = dev_get_drvdata(dev); - regcache_mark_dirty(i2s->regmap); + if (i2s) + regcache_mark_dirty(i2s->regmap); + return 0; } #endif @@ -907,7 +909,6 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev) ret = -ENOMEM; goto err; } - dev_set_drvdata(&pdev->dev, i2s); i2s->soc_data = soc_data; i2s->tx_mask = i2s->rx_mask = 0xFFFF; @@ -1081,6 +1082,8 @@ err_dap: goto err_suspend; } + dev_set_drvdata(&pdev->dev, i2s); + return 0; err_suspend: diff --git a/sound/soc/tegra-alt/tegra210_iqc_alt.c b/sound/soc/tegra-alt/tegra210_iqc_alt.c index b46eb27d..e13e6c85 100644 --- a/sound/soc/tegra-alt/tegra210_iqc_alt.c +++ b/sound/soc/tegra-alt/tegra210_iqc_alt.c @@ -88,7 +88,9 @@ static int tegra210_iqc_suspend(struct device *dev) { struct tegra210_iqc *iqc = dev_get_drvdata(dev); - regcache_mark_dirty(iqc->regmap); + if (iqc) + regcache_mark_dirty(iqc->regmap); + return 0; } #endif @@ -340,7 +342,6 @@ static int tegra210_iqc_platform_probe(struct platform_device *pdev) ret = -ENOMEM; goto err; } - dev_set_drvdata(&pdev->dev, iqc); iqc->soc_data = soc_data; @@ -424,6 +425,8 @@ static int tegra210_iqc_platform_probe(struct platform_device *pdev) goto err_suspend; } + dev_set_drvdata(&pdev->dev, iqc); + return 0; err_suspend: diff --git a/sound/soc/tegra-alt/tegra210_mixer_alt.c b/sound/soc/tegra-alt/tegra210_mixer_alt.c index 34874552..1ebc5e88 100644 --- a/sound/soc/tegra-alt/tegra210_mixer_alt.c +++ b/sound/soc/tegra-alt/tegra210_mixer_alt.c @@ -108,7 +108,9 @@ static int tegra210_mixer_suspend(struct device *dev) { struct tegra210_mixer *mixer = dev_get_drvdata(dev); - regcache_mark_dirty(mixer->regmap); + if (mixer) + regcache_mark_dirty(mixer->regmap); + return 0; } #endif @@ -651,7 +653,6 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev) ret = -ENOMEM; goto err; } - dev_set_drvdata(&pdev->dev, mixer); mixer->soc_data = soc_data; mixer->gain_coeff[0] = 0; @@ -727,6 +728,8 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev) goto err_suspend; } + dev_set_drvdata(&pdev->dev, mixer); + return 0; err_suspend: diff --git a/sound/soc/tegra-alt/tegra210_mvc_alt.c b/sound/soc/tegra-alt/tegra210_mvc_alt.c index ab5c8faa..be3056d9 100644 --- a/sound/soc/tegra-alt/tegra210_mvc_alt.c +++ b/sound/soc/tegra-alt/tegra210_mvc_alt.c @@ -91,7 +91,9 @@ static int tegra210_mvc_suspend(struct device *dev) { struct tegra210_mvc *mvc = dev_get_drvdata(dev); - regcache_mark_dirty(mvc->regmap); + if (mvc) + regcache_mark_dirty(mvc->regmap); + return 0; } #endif @@ -635,7 +637,6 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev) ret = -ENOMEM; goto err; } - dev_set_drvdata(&pdev->dev, mvc); mvc->soc_data = soc_data; @@ -710,6 +711,8 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev) goto err_suspend; } + dev_set_drvdata(&pdev->dev, mvc); + return 0; err_suspend: diff --git a/sound/soc/tegra-alt/tegra210_ope_alt.c b/sound/soc/tegra-alt/tegra210_ope_alt.c index 0dcce9c5..6ab1c994 100644 --- a/sound/soc/tegra-alt/tegra210_ope_alt.c +++ b/sound/soc/tegra-alt/tegra210_ope_alt.c @@ -84,9 +84,12 @@ static int tegra210_ope_suspend(struct device *dev) { struct tegra210_ope *ope = dev_get_drvdata(dev); - regcache_mark_dirty(ope->regmap); - regcache_mark_dirty(ope->peq_regmap); - regcache_mark_dirty(ope->mbdrc_regmap); + if (ope) { + regcache_mark_dirty(ope->regmap); + regcache_mark_dirty(ope->peq_regmap); + regcache_mark_dirty(ope->mbdrc_regmap); + } + return 0; } #endif @@ -353,7 +356,6 @@ static int tegra210_ope_platform_probe(struct platform_device *pdev) ret = -ENOMEM; goto err; } - dev_set_drvdata(&pdev->dev, ope); ope->soc_data = soc_data; @@ -388,6 +390,8 @@ static int tegra210_ope_platform_probe(struct platform_device *pdev) } regcache_cache_only(ope->regmap, true); + dev_set_drvdata(&pdev->dev, ope); + ret = ope->soc_data->peq_soc_data.init(pdev, TEGRA210_PEQ_IORESOURCE_MEM); if (ret < 0) { diff --git a/sound/soc/tegra-alt/tegra210_sfc_alt.c b/sound/soc/tegra-alt/tegra210_sfc_alt.c index 8209ab9f..a01c6f04 100644 --- a/sound/soc/tegra-alt/tegra210_sfc_alt.c +++ b/sound/soc/tegra-alt/tegra210_sfc_alt.c @@ -95,7 +95,9 @@ static int tegra210_sfc_suspend(struct device *dev) { struct tegra210_sfc *sfc = dev_get_drvdata(dev); - regcache_mark_dirty(sfc->regmap); + if (sfc) + regcache_mark_dirty(sfc->regmap); + return 0; } #endif @@ -864,7 +866,6 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev) ret = -ENOMEM; goto err; } - dev_set_drvdata(&pdev->dev, sfc); sfc->soc_data = soc_data; @@ -926,6 +927,8 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev) goto err_suspend; } + dev_set_drvdata(&pdev->dev, sfc); + return 0; err_suspend: diff --git a/sound/soc/tegra-alt/tegra210_spdif_alt.c b/sound/soc/tegra-alt/tegra210_spdif_alt.c index 582bdd50..55402261 100644 --- a/sound/soc/tegra-alt/tegra210_spdif_alt.c +++ b/sound/soc/tegra-alt/tegra210_spdif_alt.c @@ -107,7 +107,9 @@ static int tegra210_spdif_suspend(struct device *dev) { struct tegra210_spdif *spdif = dev_get_drvdata(dev); - regcache_mark_dirty(spdif->regmap); + if (spdif) + regcache_mark_dirty(spdif->regmap); + return 0; } #endif @@ -397,7 +399,6 @@ static int tegra210_spdif_platform_probe(struct platform_device *pdev) ret = -ENOMEM; goto err; } - dev_set_drvdata(&pdev->dev, spdif); spdif->soc_data = soc_data; if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) { @@ -473,6 +474,8 @@ static int tegra210_spdif_platform_probe(struct platform_device *pdev) if (of_property_read_string(np, "prod-name", &prod_name) == 0) tegra_pinctrl_config_prod(&pdev->dev, prod_name); + dev_set_drvdata(&pdev->dev, spdif); + return 0; err_suspend: