Message ID | 87musurutv.wl-kuninori.morimoto.gx@renesas.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ASoC: use devm_snd_soc_register_component() | expand |
On Fri, Sep 07, 2018 at 01:01:05AM +0000, Kuninori Morimoto wrote: > @@ -422,8 +420,6 @@ static int ep93xx_ac97_remove(struct platform_device *pdev) > { > struct ep93xx_ac97_info *info = platform_get_drvdata(pdev); > > - snd_soc_unregister_component(&pdev->dev); > - > /* disable the AC97 controller */ > ep93xx_ac97_write_reg(info, AC97GCR, 0); > Similar ordering thing here - it's generally fine to convert to devm_ if the unregister is the last thing in the remove function but otherwise you need to be careful.
Hi Mark Thank you for your feedback > > @@ -422,8 +420,6 @@ static int ep93xx_ac97_remove(struct platform_device *pdev) > > { > > struct ep93xx_ac97_info *info = platform_get_drvdata(pdev); > > > > - snd_soc_unregister_component(&pdev->dev); > > - > > /* disable the AC97 controller */ > > ep93xx_ac97_write_reg(info, AC97GCR, 0); > > > > Similar ordering thing here - it's generally fine to convert to devm_ if > the unregister is the last thing in the remove function but otherwise > you need to be careful. I see. OK, please skip it. Best regards --- Kuninori Morimoto
diff --git a/sound/soc/cirrus/ep93xx-ac97.c b/sound/soc/cirrus/ep93xx-ac97.c index cd5a939..ecbe3c2 100644 --- a/sound/soc/cirrus/ep93xx-ac97.c +++ b/sound/soc/cirrus/ep93xx-ac97.c @@ -399,19 +399,17 @@ static int ep93xx_ac97_probe(struct platform_device *pdev) if (ret) goto fail; - ret = snd_soc_register_component(&pdev->dev, &ep93xx_ac97_component, + ret = devm_snd_soc_register_component(&pdev->dev, &ep93xx_ac97_component, &ep93xx_ac97_dai, 1); if (ret) goto fail; ret = devm_ep93xx_pcm_platform_register(&pdev->dev); if (ret) - goto fail_unregister; + goto fail; return 0; -fail_unregister: - snd_soc_unregister_component(&pdev->dev); fail: ep93xx_ac97_info = NULL; snd_soc_set_ac97_ops(NULL); @@ -422,8 +420,6 @@ static int ep93xx_ac97_remove(struct platform_device *pdev) { struct ep93xx_ac97_info *info = platform_get_drvdata(pdev); - snd_soc_unregister_component(&pdev->dev); - /* disable the AC97 controller */ ep93xx_ac97_write_reg(info, AC97GCR, 0); diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c index 0918c5d..f5c3407 100644 --- a/sound/soc/cirrus/ep93xx-i2s.c +++ b/sound/soc/cirrus/ep93xx-i2s.c @@ -478,19 +478,17 @@ static int ep93xx_i2s_probe(struct platform_device *pdev) dev_set_drvdata(&pdev->dev, info); - err = snd_soc_register_component(&pdev->dev, &ep93xx_i2s_component, + err = devm_snd_soc_register_component(&pdev->dev, &ep93xx_i2s_component, &ep93xx_i2s_dai, 1); if (err) goto fail_put_lrclk; err = devm_ep93xx_pcm_platform_register(&pdev->dev); if (err) - goto fail_unregister; + goto fail_put_lrclk; return 0; -fail_unregister: - snd_soc_unregister_component(&pdev->dev); fail_put_lrclk: clk_put(info->lrclk); fail_put_sclk: @@ -505,7 +503,6 @@ static int ep93xx_i2s_remove(struct platform_device *pdev) { struct ep93xx_i2s_info *info = dev_get_drvdata(&pdev->dev); - snd_soc_unregister_component(&pdev->dev); clk_put(info->lrclk); clk_put(info->sclk); clk_put(info->mclk);