All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: tegra: s/IS_ERR_OR_NULL/IS_ERR/ for clk_get_sys
@ 2011-01-11 19:48 Stephen Warren
  2011-01-13 13:39 ` Liam Girdwood
  2011-01-13 13:58 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Warren @ 2011-01-11 19:48 UTC (permalink / raw)
  To: broonie, lrg; +Cc: linux-tegra, alsa-devel, Stephen Warren

A recent discussion on linux-arm-kernel noted that the value returned by
clk_get_sys is an opaque token, and not strictly a pointer; it is
meaningful only to the clock API, clients should not dereference the value,
and the clock API must accept any non-IS_ERR value it returned.

Hence, only IS_ERR is appropriate to interpret the result, not
IS_ERR_OR_NULL.

I checked that clk_get_sys in both ASoC's for-next and Tegra's for-next
do behave as described; NULL is not returned in the case of error.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 sound/soc/tegra/tegra_asoc_utils.c |   20 +++++++++-----------
 sound/soc/tegra/tegra_i2s.c        |    2 +-
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/sound/soc/tegra/tegra_asoc_utils.c b/sound/soc/tegra/tegra_asoc_utils.c
index 711ab7f..cfe2ea8 100644
--- a/sound/soc/tegra/tegra_asoc_utils.c
+++ b/sound/soc/tegra/tegra_asoc_utils.c
@@ -113,35 +113,33 @@ int tegra_asoc_utils_init(void)
 	int ret;
 
 	clk_pll_a = clk_get_sys(NULL, "pll_a");
-	if (IS_ERR_OR_NULL(clk_pll_a)) {
+	if (IS_ERR(clk_pll_a)) {
 		pr_err(PREFIX "Can't retrieve clk pll_a\n");
 		ret = PTR_ERR(clk_pll_a);
 		goto err;
 	}
 
 	clk_pll_a_out0 = clk_get_sys(NULL, "pll_a_out0");
-	if (IS_ERR_OR_NULL(clk_pll_a_out0)) {
+	if (IS_ERR(clk_pll_a_out0)) {
 		pr_err(PREFIX "Can't retrieve clk pll_a_out0\n");
 		ret = PTR_ERR(clk_pll_a_out0);
-		goto err;
+		goto err_put_pll_a;
 	}
 
 	clk_cdev1 = clk_get_sys(NULL, "cdev1");
-	if (IS_ERR_OR_NULL(clk_cdev1)) {
+	if (IS_ERR(clk_cdev1)) {
 		pr_err(PREFIX "Can't retrieve clk cdev1\n");
 		ret = PTR_ERR(clk_cdev1);
-		goto err;
+		goto err_put_pll_a_out0;
 	}
 
 	return 0;
 
+err_put_pll_a_out0:
+	clk_put(clk_pll_a_out0);
+err_put_pll_a:
+	clk_put(clk_pll_a);
 err:
-	if (!IS_ERR_OR_NULL(clk_cdev1))
-		clk_put(clk_cdev1);
-	if (!IS_ERR_OR_NULL(clk_pll_a_out0))
-		clk_put(clk_pll_a_out0);
-	if (!IS_ERR_OR_NULL(clk_pll_a))
-		clk_put(clk_pll_a);
 	return ret;
 }
 
diff --git a/sound/soc/tegra/tegra_i2s.c b/sound/soc/tegra/tegra_i2s.c
index 9b7a22a..75d3bfe 100644
--- a/sound/soc/tegra/tegra_i2s.c
+++ b/sound/soc/tegra/tegra_i2s.c
@@ -385,7 +385,7 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev)
 
 	snprintf(clk_name, sizeof(clk_name), DRV_NAME ".%d", pdev->id);
 	i2s->clk_i2s = clk_get_sys(clk_name, NULL);
-	if (IS_ERR_OR_NULL(i2s->clk_i2s)) {
+	if (IS_ERR(i2s->clk_i2s)) {
 		pr_err("Can't retrieve i2s clock\n");
 		ret = PTR_ERR(i2s->clk_i2s);
 		goto err_free;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: tegra: s/IS_ERR_OR_NULL/IS_ERR/ for clk_get_sys
  2011-01-11 19:48 [PATCH] ASoC: tegra: s/IS_ERR_OR_NULL/IS_ERR/ for clk_get_sys Stephen Warren
@ 2011-01-13 13:39 ` Liam Girdwood
  2011-01-13 13:58 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2011-01-13 13:39 UTC (permalink / raw)
  To: Stephen Warren; +Cc: linux-tegra, alsa-devel, broonie

On Tue, 2011-01-11 at 12:48 -0700, Stephen Warren wrote:
> A recent discussion on linux-arm-kernel noted that the value returned by
> clk_get_sys is an opaque token, and not strictly a pointer; it is
> meaningful only to the clock API, clients should not dereference the value,
> and the clock API must accept any non-IS_ERR value it returned.
> 
> Hence, only IS_ERR is appropriate to interpret the result, not
> IS_ERR_OR_NULL.
> 
> I checked that clk_get_sys in both ASoC's for-next and Tegra's for-next
> do behave as described; NULL is not returned in the case of error.
> 
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: tegra: s/IS_ERR_OR_NULL/IS_ERR/ for clk_get_sys
  2011-01-11 19:48 [PATCH] ASoC: tegra: s/IS_ERR_OR_NULL/IS_ERR/ for clk_get_sys Stephen Warren
  2011-01-13 13:39 ` Liam Girdwood
@ 2011-01-13 13:58 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2011-01-13 13:58 UTC (permalink / raw)
  To: Stephen Warren; +Cc: linux-tegra, alsa-devel, lrg

On Tue, Jan 11, 2011 at 12:48:53PM -0700, Stephen Warren wrote:
> A recent discussion on linux-arm-kernel noted that the value returned by
> clk_get_sys is an opaque token, and not strictly a pointer; it is
> meaningful only to the clock API, clients should not dereference the value,
> and the clock API must accept any non-IS_ERR value it returned.

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-13 13:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-11 19:48 [PATCH] ASoC: tegra: s/IS_ERR_OR_NULL/IS_ERR/ for clk_get_sys Stephen Warren
2011-01-13 13:39 ` Liam Girdwood
2011-01-13 13:58 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.