Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1445374

Re: [PATCH v4 4/4] ASoC: samsung: Add machine driver for Exynos5433 based TM2 board

From Sylwester Nawrocki <s.nawrocki@samsung.com>
Newsgroups linux.kernel
Subject Re: [PATCH v4 4/4] ASoC: samsung: Add machine driver for Exynos5433 based TM2 board
Date 2016-07-18 12:50 +0200
Message-ID <rWehz-53k-1@gated-at.bofh.it> (permalink)
References <rV3Hz-2Ms-11@gated-at.bofh.it> <rRCaR-5LK-25@gated-at.bofh.it> <rV3Hz-2Ms-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Chanwoo,

On 07/15/2016 07:18 AM, Chanwoo Choi wrote:
>> +static int tm2_probe(struct platform_device *pdev)
>> +{
>> +	struct device *dev = &pdev->dev;

>> +	codec_dai_node = of_parse_phandle(dev->of_node, "audio-codec", 0);
>> +	if (!codec_dai_node) {
>> +		dev_err(dev, "audio-codec property invalid or missing\n");
>> +		ret = -EINVAL;
>> +		goto err_put_cpu_dai;
>> +	}

>> +	priv->codec_mclk1 = of_clk_get_by_name(codec_dai_node, "mclk1");
>> +	if (IS_ERR(priv->codec_mclk1)) {
>> +		dev_err(dev, "Failed to get mclk1 clock\n");
>> +		ret = PTR_ERR(priv->codec_mclk1);
>> +		goto err_put_codec_dai;
>> +	}
> 
> I think that you better to use the devm_clk_get() instead of of_clk_get_by_name()
> because you don't need to handle the clk_put() when error happen and remove the 
> this driver.
> 
> 	priv->codec_mclk1 = devm_clk_get(dev, "mclk1");

The clocks are from the CODEC DT node, for which we don't have struct
device pointer here, that's why I used of_clk_get_by_name().

--
Thanks,
Sylwester

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v4 4/4] ASoC: samsung: Add machine driver for Exynos5433  based TM2 board Chanwoo Choi <cw00.choi@samsung.com> - 2016-07-15 07:20 +0200
  Re: [PATCH v4 4/4] ASoC: samsung: Add machine driver for Exynos5433  based TM2 board Sylwester Nawrocki <s.nawrocki@samsung.com> - 2016-07-18 12:50 +0200
    Re: [PATCH v4 4/4] ASoC: samsung: Add machine driver for Exynos5433  based TM2 board Chanwoo Choi <cw00.choi@samsung.com> - 2016-07-21 12:30 +0200
      Re: [alsa-devel] [PATCH v4 4/4] ASoC: samsung: Add machine driver for  Exynos5433 based TM2 board Sylwester Nawrocki <s.nawrocki@samsung.com> - 2016-07-21 17:20 +0200

csiph-web