diff mbox series

ASoC: mxs-saif: Add variable dev to simplify code

Message ID 20200429094023.12856-1-tangbin@cmss.chinamobile.com
State New
Headers show
Series ASoC: mxs-saif: Add variable dev to simplify code | expand

Commit Message

Tang Bin April 29, 2020, 9:40 a.m. UTC
Add variable 'dev' to make the code cleaner in the function
mxs_saif_probe(). And now that the function mxs_saif_mclk_init()
have defined the variables 'ret' as the error returned value,
then it should be used instead in this place.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 sound/soc/mxs/mxs-saif.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index dc197883e..f4e441183 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -719,7 +719,7 @@  static int mxs_saif_mclk_init(struct platform_device *pdev)
 		if (ret == -EEXIST)
 			return 0;
 		dev_err(&pdev->dev, "failed to register mclk: %d\n", ret);
-		return PTR_ERR(clk);
+		return ret;
 	}
 
 	ret = of_clk_add_provider(np, of_clk_src_simple_get, clk);
@@ -732,6 +732,7 @@  static int mxs_saif_mclk_init(struct platform_device *pdev)
 static int mxs_saif_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
+	struct device *dev = &pdev->dev;
 	struct mxs_saif *saif;
 	int irq, ret;
 	struct device_node *master;
@@ -739,7 +740,7 @@  static int mxs_saif_probe(struct platform_device *pdev)
 	if (!np)
 		return -EINVAL;
 
-	saif = devm_kzalloc(&pdev->dev, sizeof(*saif), GFP_KERNEL);
+	saif = devm_kzalloc(dev, sizeof(*saif), GFP_KERNEL);
 	if (!saif)
 		return -ENOMEM;
 
@@ -750,7 +751,7 @@  static int mxs_saif_probe(struct platform_device *pdev)
 		saif->id = ret;
 
 	if (saif->id >= ARRAY_SIZE(mxs_saif)) {
-		dev_err(&pdev->dev, "get wrong saif id\n");
+		dev_err(dev, "get wrong saif id\n");
 		return -EINVAL;
 	}
 
@@ -770,18 +771,17 @@  static int mxs_saif_probe(struct platform_device *pdev)
 			saif->master_id = ret;
 
 		if (saif->master_id >= ARRAY_SIZE(mxs_saif)) {
-			dev_err(&pdev->dev, "get wrong master id\n");
+			dev_err(dev, "get wrong master id\n");
 			return -EINVAL;
 		}
 	}
 
 	mxs_saif[saif->id] = saif;
 
-	saif->clk = devm_clk_get(&pdev->dev, NULL);
+	saif->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(saif->clk)) {
 		ret = PTR_ERR(saif->clk);
-		dev_err(&pdev->dev, "Cannot get the clock: %d\n",
-			ret);
+		dev_err(dev, "Cannot get the clock: %d\n", ret);
 		return ret;
 	}
 
@@ -793,11 +793,11 @@  static int mxs_saif_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
-	saif->dev = &pdev->dev;
-	ret = devm_request_irq(&pdev->dev, irq, mxs_saif_irq, 0,
-			       dev_name(&pdev->dev), saif);
+	saif->dev = dev;
+	ret = devm_request_irq(dev, irq, mxs_saif_irq, 0,
+			       dev_name(dev), saif);
 	if (ret) {
-		dev_err(&pdev->dev, "failed to request irq\n");
+		dev_err(dev, "failed to request irq\n");
 		return ret;
 	}
 
@@ -807,19 +807,19 @@  static int mxs_saif_probe(struct platform_device *pdev)
 	if (saif->id == 0) {
 		ret = mxs_saif_mclk_init(pdev);
 		if (ret)
-			dev_warn(&pdev->dev, "failed to init clocks\n");
+			dev_warn(dev, "failed to init clocks\n");
 	}
 
-	ret = devm_snd_soc_register_component(&pdev->dev, &mxs_saif_component,
+	ret = devm_snd_soc_register_component(dev, &mxs_saif_component,
 					      &mxs_saif_dai, 1);
 	if (ret) {
-		dev_err(&pdev->dev, "register DAI failed\n");
+		dev_err(dev, "register DAI failed\n");
 		return ret;
 	}
 
-	ret = mxs_pcm_platform_register(&pdev->dev);
+	ret = mxs_pcm_platform_register(dev);
 	if (ret) {
-		dev_err(&pdev->dev, "register PCM failed: %d\n", ret);
+		dev_err(dev, "register PCM failed: %d\n", ret);
 		return ret;
 	}