linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'
@ 2017-06-15  5:53 Christophe JAILLET
  2017-06-15 11:38 ` kbuild test robot
  2017-06-15 17:20 ` Applied "ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'" to the asoc tree Mark Brown
  0 siblings, 2 replies; 7+ messages in thread
From: Christophe JAILLET @ 2017-06-15  5:53 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, heiko
  Cc: alsa-devel, linux-arm-kernel, linux-rockchip, linux-kernel,
	kernel-janitors, Christophe JAILLET

If this memory allocation fail, we must disable what has been enabled.
Do not return immediately but go thrue the error handling path instead.

Also use 'devm_kmemdup' instead of 'devm_kzalloc+memcpy' to simplify code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 sound/soc/rockchip/rockchip_i2s.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index af5e0da144f7..f3aa3dfe914b 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -643,12 +643,13 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
 			goto err_pm_disable;
 	}
 
-	soc_dai = devm_kzalloc(&pdev->dev,
+	soc_dai = devm_kmemdup(&pdev->dev, &rockchip_i2s_dai
 			       sizeof(*soc_dai), GFP_KERNEL);
-	if (!soc_dai)
-		return -ENOMEM;
+	if (!soc_dai) {
+		err = -ENOMEM;
+		goto err_pm_disable;
+	}
 
-	memcpy(soc_dai, &rockchip_i2s_dai, sizeof(*soc_dai));
 	if (!of_property_read_u32(node, "rockchip,playback-channels", &val)) {
 		if (val >= 2 && val <= 8)
 			soc_dai->playback.channels_max = val;
-- 
2.11.0

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

* Re: [PATCH] ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'
  2017-06-15  5:53 [PATCH] ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe' Christophe JAILLET
@ 2017-06-15 11:38 ` kbuild test robot
  2017-06-15 17:20 ` Applied "ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'" to the asoc tree Mark Brown
  1 sibling, 0 replies; 7+ messages in thread
From: kbuild test robot @ 2017-06-15 11:38 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: kbuild-all, lgirdwood, broonie, perex, tiwai, heiko, alsa-devel,
	linux-arm-kernel, linux-rockchip, linux-kernel, kernel-janitors,
	Christophe JAILLET

[-- Attachment #1: Type: text/plain, Size: 2481 bytes --]

Hi Christophe,

[auto build test ERROR on rockchip/for-next]
[also build test ERROR on v4.12-rc5 next-20170615]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Christophe-JAILLET/ASoC-rockchip-Fix-an-error-handling-in-rockchip_i2s_probe/20170615-184817
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   sound/soc//rockchip/rockchip_i2s.c: In function 'rockchip_i2s_probe':
>> sound/soc//rockchip/rockchip_i2s.c:619:11: error: expected ')' before 'sizeof'
              sizeof(*soc_dai), GFP_KERNEL);
              ^
>> sound/soc//rockchip/rockchip_i2s.c:618:12: error: too few arguments to function 'devm_kmemdup'
     soc_dai = devm_kmemdup(&pdev->dev, &rockchip_i2s_dai
               ^
   In file included from include/linux/gpio/driver.h:4:0,
                    from include/asm-generic/gpio.h:12,
                    from include/linux/gpio.h:51,
                    from include/linux/of_gpio.h:20,
                    from sound/soc//rockchip/rockchip_i2s.c:16:
   include/linux/device.h:684:14: note: declared here
    extern void *devm_kmemdup(struct device *dev, const void *src, size_t len,
                 ^
>> sound/soc//rockchip/rockchip_i2s.c:621:3: error: 'err' undeclared (first use in this function)
      err = -ENOMEM;
      ^
   sound/soc//rockchip/rockchip_i2s.c:621:3: note: each undeclared identifier is reported only once for each function it appears in

vim +/devm_kmemdup +618 sound/soc//rockchip/rockchip_i2s.c

   612		if (!pm_runtime_enabled(&pdev->dev)) {
   613			ret = i2s_runtime_resume(&pdev->dev);
   614			if (ret)
   615				goto err_pm_disable;
   616		}
   617	
 > 618		soc_dai = devm_kmemdup(&pdev->dev, &rockchip_i2s_dai
 > 619				       sizeof(*soc_dai), GFP_KERNEL);
   620		if (!soc_dai) {
 > 621			err = -ENOMEM;
   622			goto err_pm_disable;
   623		}
   624	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 50141 bytes --]

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

* Applied "ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'" to the asoc tree
  2017-06-15  5:53 [PATCH] ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe' Christophe JAILLET
  2017-06-15 11:38 ` kbuild test robot
@ 2017-06-15 17:20 ` Mark Brown
  2017-06-15 17:32   ` Christophe JAILLET
  2017-06-16  4:57   ` Christophe JAILLET
  1 sibling, 2 replies; 7+ messages in thread
From: Mark Brown @ 2017-06-15 17:20 UTC (permalink / raw)
  To: Christophe Jaillet
  Cc: Christophe JAILLET, Mark Brown, lgirdwood, broonie, perex, tiwai,
	heiko, alsa-devel, kernel-janitors, linux-kernel, linux-rockchip,
	Christophe JAILLET, linux-arm-kernel, alsa-devel

The patch

   ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From c3a3d3c41b74b05267bab6173f2a8224a1443ba6 Mon Sep 17 00:00:00 2001
From: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Date: Thu, 15 Jun 2017 07:53:11 +0200
Subject: [PATCH] ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'

If this memory allocation fail, we must disable what has been enabled.
Do not return immediately but go thrue the error handling path instead.

Also use 'devm_kmemdup' instead of 'devm_kzalloc+memcpy' to simplify code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/rockchip/rockchip_i2s.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index 66a26c56c658..ce09dee2202e 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -641,12 +641,13 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
 			goto err_pm_disable;
 	}
 
-	soc_dai = devm_kzalloc(&pdev->dev,
+	soc_dai = devm_kmemdup(&pdev->dev, &rockchip_i2s_dai
 			       sizeof(*soc_dai), GFP_KERNEL);
-	if (!soc_dai)
-		return -ENOMEM;
+	if (!soc_dai) {
+		err = -ENOMEM;
+		goto err_pm_disable;
+	}
 
-	memcpy(soc_dai, &rockchip_i2s_dai, sizeof(*soc_dai));
 	if (!of_property_read_u32(node, "rockchip,playback-channels", &val)) {
 		if (val >= 2 && val <= 8)
 			soc_dai->playback.channels_max = val;
-- 
2.11.0

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

* Re: Applied "ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'" to the asoc tree
  2017-06-15 17:20 ` Applied "ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'" to the asoc tree Mark Brown
@ 2017-06-15 17:32   ` Christophe JAILLET
  2017-06-15 19:12     ` Mark Brown
  2017-06-16  4:57   ` Christophe JAILLET
  1 sibling, 1 reply; 7+ messages in thread
From: Christophe JAILLET @ 2017-06-15 17:32 UTC (permalink / raw)
  To: Mark Brown
  Cc: lgirdwood, perex, tiwai, heiko, alsa-devel, kernel-janitors,
	linux-kernel, linux-rockchip, linux-arm-kernel

Le 15/06/2017 à 19:20, Mark Brown a écrit :
> The patch
>
>     ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'
>
> has been applied to the asoc tree at
>
>     git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
>
> All being well this means that it will be integrated into the linux-next
> tree (usually sometime in the next 24 hours) and sent to Linus during
> the next merge window (or sooner if it is a bug fix), however if
> problems are discovered then the patch may be dropped or reverted.
>
> You may get further e-mails resulting from automated or manual testing
> and review of the tree, please engage with people reporting problems and
> send followup patches addressing any issues that are reported if needed.
>
> If any updates are required or you are submitting further changes they
> should be sent as incremental updates against current git, existing
> patches will not be replaced.
>
> Please add any relevant lists and maintainers to the CCs when replying
> to this mail.
>
> Thanks,
> Mark
>
>  From c3a3d3c41b74b05267bab6173f2a8224a1443ba6 Mon Sep 17 00:00:00 2001
> From: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
> Date: Thu, 15 Jun 2017 07:53:11 +0200
> Subject: [PATCH] ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'
>
> If this memory allocation fail, we must disable what has been enabled.
> Do not return immediately but go thrue the error handling path instead.
>
> Also use 'devm_kmemdup' instead of 'devm_kzalloc+memcpy' to simplify code.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>   sound/soc/rockchip/rockchip_i2s.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
> index 66a26c56c658..ce09dee2202e 100644
> --- a/sound/soc/rockchip/rockchip_i2s.c
> +++ b/sound/soc/rockchip/rockchip_i2s.c
> @@ -641,12 +641,13 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
>   			goto err_pm_disable;
>   	}
>   
> -	soc_dai = devm_kzalloc(&pdev->dev,
> +	soc_dai = devm_kmemdup(&pdev->dev, &rockchip_i2s_dai
>   			       sizeof(*soc_dai), GFP_KERNEL);
> -	if (!soc_dai)
> -		return -ENOMEM;
> +	if (!soc_dai) {
> +		err = -ENOMEM;
> +		goto err_pm_disable;
> +	}
>   
> -	memcpy(soc_dai, &rockchip_i2s_dai, sizeof(*soc_dai));
>   	if (!of_property_read_u32(node, "rockchip,playback-channels", &val)) {
>   		if (val >= 2 && val <= 8)
>   			soc_dai->playback.channels_max = val;

Thanks for taking the patch, but there is a typo in it. A comma is 
missing as spotted by the kbuild test robot.

I hope that you have seen it and fixed it before applying.

All my patches are normally compile tested. I don't know what has gone 
wrong for this one. I apologize for the issue.

CJ

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

* Re: Applied "ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'" to the asoc tree
  2017-06-15 17:32   ` Christophe JAILLET
@ 2017-06-15 19:12     ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2017-06-15 19:12 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: lgirdwood, perex, tiwai, heiko, alsa-devel, kernel-janitors,
	linux-kernel, linux-rockchip, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 693 bytes --]

On Thu, Jun 15, 2017 at 07:32:53PM +0200, Christophe JAILLET wrote:
> Le 15/06/2017 à 19:20, Mark Brown a écrit :

> > -	memcpy(soc_dai, &rockchip_i2s_dai, sizeof(*soc_dai));
> >   	if (!of_property_read_u32(node, "rockchip,playback-channels", &val)) {
> >   		if (val >= 2 && val <= 8)
> >   			soc_dai->playback.channels_max = val;

> Thanks for taking the patch, but there is a typo in it. A comma is missing
> as spotted by the kbuild test robot.

> I hope that you have seen it and fixed it before applying.

Ugh, no.  Like the mail says this is the patch that got applied.  The
kbuild tests were against the rockchip tree not mine so i thought this
was something else...

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: Applied "ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'" to the asoc tree
  2017-06-15 17:20 ` Applied "ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'" to the asoc tree Mark Brown
  2017-06-15 17:32   ` Christophe JAILLET
@ 2017-06-16  4:57   ` Christophe JAILLET
  2017-06-16  9:18     ` Mark Brown
  1 sibling, 1 reply; 7+ messages in thread
From: Christophe JAILLET @ 2017-06-16  4:57 UTC (permalink / raw)
  To: Mark Brown
  Cc: lgirdwood, perex, tiwai, heiko, alsa-devel, kernel-janitors,
	linux-kernel, linux-rockchip, linux-arm-kernel

Le 15/06/2017 à 19:20, Mark Brown a écrit :
> The patch
>
>     ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'
>
> has been applied to the asoc tree at
>
>     git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
>
> All being well this means that it will be integrated into the linux-next
> tree (usually sometime in the next 24 hours) and sent to Linus during
> the next merge window (or sooner if it is a bug fix), however if
> problems are discovered then the patch may be dropped or reverted.
>
> You may get further e-mails resulting from automated or manual testing
> and review of the tree, please engage with people reporting problems and
> send followup patches addressing any issues that are reported if needed.
>
> If any updates are required or you are submitting further changes they
> should be sent as incremental updates against current git, existing
> patches will not be replaced.
>
> Please add any relevant lists and maintainers to the CCs when replying
> to this mail.
>
> Thanks,
> Mark
>
>  From c3a3d3c41b74b05267bab6173f2a8224a1443ba6 Mon Sep 17 00:00:00 2001
> From: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
> Date: Thu, 15 Jun 2017 07:53:11 +0200
> Subject: [PATCH] ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'
>
> If this memory allocation fail, we must disable what has been enabled.
> Do not return immediately but go thrue the error handling path instead.
>
> Also use 'devm_kmemdup' instead of 'devm_kzalloc+memcpy' to simplify code.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>   sound/soc/rockchip/rockchip_i2s.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
> index 66a26c56c658..ce09dee2202e 100644
> --- a/sound/soc/rockchip/rockchip_i2s.c
> +++ b/sound/soc/rockchip/rockchip_i2s.c
> @@ -641,12 +641,13 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
>   			goto err_pm_disable;
>   	}
>   
> -	soc_dai = devm_kzalloc(&pdev->dev,
> +	soc_dai = devm_kmemdup(&pdev->dev, &rockchip_i2s_dai
>   			       sizeof(*soc_dai), GFP_KERNEL);
> -	if (!soc_dai)
> -		return -ENOMEM;
> +	if (!soc_dai) {
> +		err = -ENOMEM;
> +		goto err_pm_disable;
> +	}
>   
> -	memcpy(soc_dai, &rockchip_i2s_dai, sizeof(*soc_dai));
>   	if (!of_property_read_u32(node, "rockchip,playback-channels", &val)) {
>   		if (val >= 2 && val <= 8)
>   			soc_dai->playback.channels_max = val;

... and 'err' should be 'ret'...

I'm really confused for such a ugly proposal !

CJ

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

* Re: Applied "ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'" to the asoc tree
  2017-06-16  4:57   ` Christophe JAILLET
@ 2017-06-16  9:18     ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2017-06-16  9:18 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: lgirdwood, perex, tiwai, heiko, alsa-devel, kernel-janitors,
	linux-kernel, linux-rockchip, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 453 bytes --]

On Fri, Jun 16, 2017 at 06:57:30AM +0200, Christophe JAILLET wrote:
> Le 15/06/2017 à 19:20, Mark Brown a écrit :

> >   	if (!of_property_read_u32(node, "rockchip,playback-channels", &val)) {
> >   		if (val >= 2 && val <= 8)
> >   			soc_dai->playback.channels_max = val;

> ... and 'err' should be 'ret'...

> I'm really confused for such a ugly proposal !

In a situation like this it's generally best to send a patch, I'll fix
though.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2017-06-16  9:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-15  5:53 [PATCH] ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe' Christophe JAILLET
2017-06-15 11:38 ` kbuild test robot
2017-06-15 17:20 ` Applied "ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'" to the asoc tree Mark Brown
2017-06-15 17:32   ` Christophe JAILLET
2017-06-15 19:12     ` Mark Brown
2017-06-16  4:57   ` Christophe JAILLET
2017-06-16  9:18     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).