[alsa-devel] [PATCH 1/2] ASoC: fsl: imx-sgtl5000: No need to initialize local variable data
The first access to this variable is an assignment to the result of a kzalloc function call. Remove the superfluous initialisation.
Signed-off-by: Philipp Zabel p.zabel@pengutronix.de --- sound/soc/fsl/imx-sgtl5000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c index f2beae7..3e60b4c 100644 --- a/sound/soc/fsl/imx-sgtl5000.c +++ b/sound/soc/fsl/imx-sgtl5000.c @@ -62,7 +62,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) struct device_node *ssi_np, *codec_np; struct platform_device *ssi_pdev; struct i2c_client *codec_dev; - struct imx_sgtl5000_data *data = NULL; + struct imx_sgtl5000_data *data; int int_port, ext_port; int ret;
Use managed devm_clk_get. There is no need to manually call clk_put anymore.
Signed-off-by: Philipp Zabel p.zabel@pengutronix.de --- sound/soc/fsl/imx-sgtl5000.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c index 3e60b4c..ba2c00b 100644 --- a/sound/soc/fsl/imx-sgtl5000.c +++ b/sound/soc/fsl/imx-sgtl5000.c @@ -128,7 +128,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) goto fail; }
- data->codec_clk = clk_get(&codec_dev->dev, NULL); + data->codec_clk = devm_clk_get(&codec_dev->dev, NULL); if (IS_ERR(data->codec_clk)) { ret = PTR_ERR(data->codec_clk); goto fail; @@ -172,8 +172,6 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) return 0;
fail: - if (data && !IS_ERR(data->codec_clk)) - clk_put(data->codec_clk); if (ssi_np) of_node_put(ssi_np); if (codec_np) @@ -184,10 +182,6 @@ fail:
static int imx_sgtl5000_remove(struct platform_device *pdev) { - struct imx_sgtl5000_data *data = platform_get_drvdata(pdev); - - clk_put(data->codec_clk); - return 0; }
Hi Philipp,
On Thu, Jan 30, 2014 at 10:47:18AM +0100, Philipp Zabel wrote:
Use managed devm_clk_get. There is no need to manually call clk_put anymore.
http://comments.gmane.org/gmane.linux.alsa.devel/109093 Fabio and Shawn have discussed this before.
Thanks, Nicolin
---
Signed-off-by: Philipp Zabel p.zabel@pengutronix.de
sound/soc/fsl/imx-sgtl5000.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c index 3e60b4c..ba2c00b 100644 --- a/sound/soc/fsl/imx-sgtl5000.c +++ b/sound/soc/fsl/imx-sgtl5000.c @@ -128,7 +128,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) goto fail; }
- data->codec_clk = clk_get(&codec_dev->dev, NULL);
- data->codec_clk = devm_clk_get(&codec_dev->dev, NULL); if (IS_ERR(data->codec_clk)) { ret = PTR_ERR(data->codec_clk); goto fail;
@@ -172,8 +172,6 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) return 0;
fail:
- if (data && !IS_ERR(data->codec_clk))
if (ssi_np) of_node_put(ssi_np); if (codec_np)clk_put(data->codec_clk);
@@ -184,10 +182,6 @@ fail:
static int imx_sgtl5000_remove(struct platform_device *pdev) {
- struct imx_sgtl5000_data *data = platform_get_drvdata(pdev);
- clk_put(data->codec_clk);
- return 0;
}
-- 1.8.5.3
Hi Nicolin,
Am Donnerstag, den 30.01.2014, 18:25 +0800 schrieb Nicolin Chen:
Hi Philipp,
On Thu, Jan 30, 2014 at 10:47:18AM +0100, Philipp Zabel wrote:
Use managed devm_clk_get. There is no need to manually call clk_put anymore.
http://comments.gmane.org/gmane.linux.alsa.devel/109093 Fabio and Shawn have discussed this before.
thanks, I got it the wrong way around. Instead I'll have to replace the devm_clk_get in the ssm2603 with clk_get/put.
regards Philipp
On Thu, Jan 30, 2014 at 11:42:15AM +0100, Philipp Zabel wrote:
thanks, I got it the wrong way around. Instead I'll have to replace the devm_clk_get in the ssm2603 with clk_get/put.
What would be better would be to move it to the bus probe rather than the ASoC level probe.
participants (3)
-
Mark Brown
-
Nicolin Chen
-
Philipp Zabel