* [PATCH] ASoC: samsung: Fix checking return value of clk_get
@ 2011-09-13 14:44 Axel Lin
2011-09-13 14:54 ` Liam Girdwood
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Axel Lin @ 2011-09-13 14:44 UTC (permalink / raw)
To: linux-kernel
Cc: Christian Pellegrin, Ben Dooks, Jassi Brar, Sangbeom Kim,
Liam Girdwood, Mark Brown, alsa-devel
clk_get() returns a pointer to the struct clk or an ERR_PTR().
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Christian Pellegrin <chripell@evolware.org>
Cc: Ben Dooks <ben@simtec.co.uk>
Cc: Sangbeom Kim <sbkim73@samsung.com>
Cc: Jassi Brar <jassisinghbrar@gmail.com>
---
sound/soc/samsung/s3c2412-i2s.c | 2 +-
sound/soc/samsung/s3c24xx-i2s.c | 2 +-
sound/soc/samsung/s3c24xx_uda134x.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c
index 841ab14..cecdbad 100644
--- a/sound/soc/samsung/s3c2412-i2s.c
+++ b/sound/soc/samsung/s3c2412-i2s.c
@@ -69,7 +69,7 @@ static int s3c2412_i2s_probe(struct snd_soc_dai *dai)
s3c2412_i2s.dma_playback = &s3c2412_i2s_pcm_stereo_out;
s3c2412_i2s.iis_cclk = clk_get(dai->dev, "i2sclk");
- if (s3c2412_i2s.iis_cclk == NULL) {
+ if (IS_ERR(s3c2412_i2s.iis_cclk)) {
pr_err("failed to get i2sclk clock\n");
iounmap(s3c2412_i2s.regs);
return -ENODEV;
diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c
index 63d8849..9f888bc 100644
--- a/sound/soc/samsung/s3c24xx-i2s.c
+++ b/sound/soc/samsung/s3c24xx-i2s.c
@@ -383,7 +383,7 @@ static int s3c24xx_i2s_probe(struct snd_soc_dai *dai)
return -ENXIO;
s3c24xx_i2s.iis_clk = clk_get(dai->dev, "iis");
- if (s3c24xx_i2s.iis_clk == NULL) {
+ if (IS_ERR(s3c24xx_i2s.iis_clk)) {
pr_err("failed to get iis_clock\n");
iounmap(s3c24xx_i2s.regs);
return -ENODEV;
diff --git a/sound/soc/samsung/s3c24xx_uda134x.c b/sound/soc/samsung/s3c24xx_uda134x.c
index dc9d551..4da57cd 100644
--- a/sound/soc/samsung/s3c24xx_uda134x.c
+++ b/sound/soc/samsung/s3c24xx_uda134x.c
@@ -66,13 +66,13 @@ static int s3c24xx_uda134x_startup(struct snd_pcm_substream *substream)
pr_debug("%s %d\n", __func__, clk_users);
if (clk_users == 0) {
xtal = clk_get(&s3c24xx_uda134x_snd_device->dev, "xtal");
- if (!xtal) {
+ if (IS_ERR(xtal)) {
printk(KERN_ERR "%s cannot get xtal\n", __func__);
ret = -EBUSY;
} else {
pclk = clk_get(&s3c24xx_uda134x_snd_device->dev,
"pclk");
- if (!pclk) {
+ if (IS_ERR(pclk)) {
printk(KERN_ERR "%s cannot get pclk\n",
__func__);
clk_put(xtal);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] ASoC: samsung: Fix checking return value of clk_get
2011-09-13 14:44 [PATCH] ASoC: samsung: Fix checking return value of clk_get Axel Lin
@ 2011-09-13 14:54 ` Liam Girdwood
2011-09-13 15:14 ` Mark Brown
2011-09-15 2:17 ` Sangbeom Kim
2 siblings, 0 replies; 5+ messages in thread
From: Liam Girdwood @ 2011-09-13 14:54 UTC (permalink / raw)
To: Axel Lin
Cc: linux-kernel, Christian Pellegrin, Ben Dooks, Jassi Brar,
Sangbeom Kim, Mark Brown, alsa-devel
On Tue, 2011-09-13 at 22:44 +0800, Axel Lin wrote:
> clk_get() returns a pointer to the struct clk or an ERR_PTR().
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> Cc: Christian Pellegrin <chripell@evolware.org>
> Cc: Ben Dooks <ben@simtec.co.uk>
> Cc: Sangbeom Kim <sbkim73@samsung.com>
> Cc: Jassi Brar <jassisinghbrar@gmail.com>
> ---
> sound/soc/samsung/s3c2412-i2s.c | 2 +-
> sound/soc/samsung/s3c24xx-i2s.c | 2 +-
> sound/soc/samsung/s3c24xx_uda134x.c | 4 ++--
> 3 files changed, 4 insertions(+), 4 deletions(-)
Acked-by: Liam Girdwood <lrg@ti.com>
>
> diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c
> index 841ab14..cecdbad 100644
> --- a/sound/soc/samsung/s3c2412-i2s.c
> +++ b/sound/soc/samsung/s3c2412-i2s.c
> @@ -69,7 +69,7 @@ static int s3c2412_i2s_probe(struct snd_soc_dai *dai)
> s3c2412_i2s.dma_playback = &s3c2412_i2s_pcm_stereo_out;
>
> s3c2412_i2s.iis_cclk = clk_get(dai->dev, "i2sclk");
> - if (s3c2412_i2s.iis_cclk == NULL) {
> + if (IS_ERR(s3c2412_i2s.iis_cclk)) {
> pr_err("failed to get i2sclk clock\n");
> iounmap(s3c2412_i2s.regs);
> return -ENODEV;
> diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c
> index 63d8849..9f888bc 100644
> --- a/sound/soc/samsung/s3c24xx-i2s.c
> +++ b/sound/soc/samsung/s3c24xx-i2s.c
> @@ -383,7 +383,7 @@ static int s3c24xx_i2s_probe(struct snd_soc_dai *dai)
> return -ENXIO;
>
> s3c24xx_i2s.iis_clk = clk_get(dai->dev, "iis");
> - if (s3c24xx_i2s.iis_clk == NULL) {
> + if (IS_ERR(s3c24xx_i2s.iis_clk)) {
> pr_err("failed to get iis_clock\n");
> iounmap(s3c24xx_i2s.regs);
> return -ENODEV;
> diff --git a/sound/soc/samsung/s3c24xx_uda134x.c b/sound/soc/samsung/s3c24xx_uda134x.c
> index dc9d551..4da57cd 100644
> --- a/sound/soc/samsung/s3c24xx_uda134x.c
> +++ b/sound/soc/samsung/s3c24xx_uda134x.c
> @@ -66,13 +66,13 @@ static int s3c24xx_uda134x_startup(struct snd_pcm_substream *substream)
> pr_debug("%s %d\n", __func__, clk_users);
> if (clk_users == 0) {
> xtal = clk_get(&s3c24xx_uda134x_snd_device->dev, "xtal");
> - if (!xtal) {
> + if (IS_ERR(xtal)) {
> printk(KERN_ERR "%s cannot get xtal\n", __func__);
> ret = -EBUSY;
> } else {
> pclk = clk_get(&s3c24xx_uda134x_snd_device->dev,
> "pclk");
> - if (!pclk) {
> + if (IS_ERR(pclk)) {
> printk(KERN_ERR "%s cannot get pclk\n",
> __func__);
> clk_put(xtal);
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] ASoC: samsung: Fix checking return value of clk_get
2011-09-13 14:44 [PATCH] ASoC: samsung: Fix checking return value of clk_get Axel Lin
2011-09-13 14:54 ` Liam Girdwood
@ 2011-09-13 15:14 ` Mark Brown
2011-09-14 2:05 ` Axel Lin
2011-09-15 2:17 ` Sangbeom Kim
2 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2011-09-13 15:14 UTC (permalink / raw)
To: Axel Lin
Cc: linux-kernel, Christian Pellegrin, Ben Dooks, Jassi Brar,
Sangbeom Kim, Liam Girdwood, alsa-devel
On Tue, Sep 13, 2011 at 10:44:22PM +0800, Axel Lin wrote:
> clk_get() returns a pointer to the struct clk or an ERR_PTR().
Are you sure that the Samsung clock implementation actually does this?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: samsung: Fix checking return value of clk_get
2011-09-13 15:14 ` Mark Brown
@ 2011-09-14 2:05 ` Axel Lin
0 siblings, 0 replies; 5+ messages in thread
From: Axel Lin @ 2011-09-14 2:05 UTC (permalink / raw)
To: Mark Brown
Cc: linux-kernel, Christian Pellegrin, Ben Dooks, Jassi Brar,
Sangbeom Kim, Liam Girdwood, alsa-devel
2011/9/13 Mark Brown <broonie@opensource.wolfsonmicro.com>:
> On Tue, Sep 13, 2011 at 10:44:22PM +0800, Axel Lin wrote:
>> clk_get() returns a pointer to the struct clk or an ERR_PTR().
>
> Are you sure that the Samsung clock implementation actually does this?
>
Yes.
In arch/arm/Kconfig, all samsung platforms select CLKDEV_LOOKUP.
The implementation of clk_get() in drivers/clk/clkdev.c returns
ERR_PTR() on failure.
Regards,
Axel
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] ASoC: samsung: Fix checking return value of clk_get
2011-09-13 14:44 [PATCH] ASoC: samsung: Fix checking return value of clk_get Axel Lin
2011-09-13 14:54 ` Liam Girdwood
2011-09-13 15:14 ` Mark Brown
@ 2011-09-15 2:17 ` Sangbeom Kim
2 siblings, 0 replies; 5+ messages in thread
From: Sangbeom Kim @ 2011-09-15 2:17 UTC (permalink / raw)
To: 'Axel Lin', linux-kernel
Cc: 'Christian Pellegrin', 'Ben Dooks',
'Jassi Brar', 'Liam Girdwood',
'Mark Brown', alsa-devel
On Tue, 2011-09-13 at 22:44 +0800, Axel Lin wrote:
> s3c2412_i2s.iis_cclk = clk_get(dai->dev, "i2sclk");
> - if (s3c2412_i2s.iis_cclk == NULL) {
> + if (IS_ERR(s3c2412_i2s.iis_cclk)) {
> pr_err("failed to get i2sclk clock\n");
> iounmap(s3c2412_i2s.regs);
> return -ENODEV;
Why don't you use PTR_ERR() for return value?
> diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-
> i2s.c
> index 63d8849..9f888bc 100644
> --- a/sound/soc/samsung/s3c24xx-i2s.c
> +++ b/sound/soc/samsung/s3c24xx-i2s.c
> @@ -383,7 +383,7 @@ static int s3c24xx_i2s_probe(struct snd_soc_dai *dai)
> return -ENXIO;
>
> s3c24xx_i2s.iis_clk = clk_get(dai->dev, "iis");
> - if (s3c24xx_i2s.iis_clk == NULL) {
> + if (IS_ERR(s3c24xx_i2s.iis_clk)) {
> pr_err("failed to get iis_clock\n");
> iounmap(s3c24xx_i2s.regs);
> return -ENODEV;
Ditto
> diff --git a/sound/soc/samsung/s3c24xx_uda134x.c
> b/sound/soc/samsung/s3c24xx_uda134x.c
> index dc9d551..4da57cd 100644
> --- a/sound/soc/samsung/s3c24xx_uda134x.c
> +++ b/sound/soc/samsung/s3c24xx_uda134x.c
> @@ -66,13 +66,13 @@ static int s3c24xx_uda134x_startup(struct
> snd_pcm_substream *substream)
> pr_debug("%s %d\n", __func__, clk_users);
> if (clk_users == 0) {
> xtal = clk_get(&s3c24xx_uda134x_snd_device->dev, "xtal");
> - if (!xtal) {
> + if (IS_ERR(xtal)) {
> printk(KERN_ERR "%s cannot get xtal\n", __func__);
> ret = -EBUSY;
Ditto
> } else {
> pclk = clk_get(&s3c24xx_uda134x_snd_device->dev,
> "pclk");
> - if (!pclk) {
> + if (IS_ERR(pclk)) {
> printk(KERN_ERR "%s cannot get pclk\n",
> __func__);
> clk_put(xtal);
> --
> 1.7.4.1
>
Thanks,
Sangbeom
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-09-15 2:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-13 14:44 [PATCH] ASoC: samsung: Fix checking return value of clk_get Axel Lin
2011-09-13 14:54 ` Liam Girdwood
2011-09-13 15:14 ` Mark Brown
2011-09-14 2:05 ` Axel Lin
2011-09-15 2:17 ` Sangbeom Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox