linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: SOF: imx8: fix memory allocation failure check on priv->pd_dev
@ 2019-12-04 12:48 Colin King
  2019-12-04 12:56 ` Daniel Baluta
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Colin King @ 2019-12-04 12:48 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Daniel Baluta, Pierre-Louis Bossart, alsa-devel,
	linux-arm-kernel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The memory allocation failure check for priv->pd_dev is incorrectly
pointer checking priv instead of priv->pd_dev. Fix this.

Addresses-Coverity: ("Logically dead code")
Fixes: 202acc565a1f ("ASoC: SOF: imx: Add i.MX8 HW support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 sound/soc/sof/imx/imx8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
index cfefcfd92798..9d926b1df0d7 100644
--- a/sound/soc/sof/imx/imx8.c
+++ b/sound/soc/sof/imx/imx8.c
@@ -209,7 +209,7 @@ static int imx8_probe(struct snd_sof_dev *sdev)
 
 	priv->pd_dev = devm_kmalloc_array(&pdev->dev, priv->num_domains,
 					  sizeof(*priv->pd_dev), GFP_KERNEL);
-	if (!priv)
+	if (!priv->pd_dev)
 		return -ENOMEM;
 
 	priv->link = devm_kmalloc_array(&pdev->dev, priv->num_domains,
-- 
2.24.0


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

* Re: [PATCH] ASoC: SOF: imx8: fix memory allocation failure check on priv->pd_dev
  2019-12-04 12:48 [PATCH] ASoC: SOF: imx8: fix memory allocation failure check on priv->pd_dev Colin King
@ 2019-12-04 12:56 ` Daniel Baluta
  2019-12-04 19:13 ` [alsa-devel] " Pierre-Louis Bossart
  2019-12-25  0:09 ` Applied "ASoC: SOF: imx8: fix memory allocation failure check on priv->pd_dev" to the asoc tree Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Baluta @ 2019-12-04 12:56 UTC (permalink / raw)
  To: Colin King
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Daniel Baluta, Pierre-Louis Bossart, Linux-ALSA,
	linux-arm-kernel, kernel-janitors, Linux Kernel Mailing List

On Wed, Dec 4, 2019 at 2:49 PM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> The memory allocation failure check for priv->pd_dev is incorrectly
> pointer checking priv instead of priv->pd_dev. Fix this.
>
> Addresses-Coverity: ("Logically dead code")
> Fixes: 202acc565a1f ("ASoC: SOF: imx: Add i.MX8 HW support")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>

Good catch! Thanks Colin!

> ---
>  sound/soc/sof/imx/imx8.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
> index cfefcfd92798..9d926b1df0d7 100644
> --- a/sound/soc/sof/imx/imx8.c
> +++ b/sound/soc/sof/imx/imx8.c
> @@ -209,7 +209,7 @@ static int imx8_probe(struct snd_sof_dev *sdev)
>
>         priv->pd_dev = devm_kmalloc_array(&pdev->dev, priv->num_domains,
>                                           sizeof(*priv->pd_dev), GFP_KERNEL);
> -       if (!priv)
> +       if (!priv->pd_dev)
>                 return -ENOMEM;
>
>         priv->link = devm_kmalloc_array(&pdev->dev, priv->num_domains,
> --
> 2.24.0
>

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

* Re: [alsa-devel] [PATCH] ASoC: SOF: imx8: fix memory allocation failure check on priv->pd_dev
  2019-12-04 12:48 [PATCH] ASoC: SOF: imx8: fix memory allocation failure check on priv->pd_dev Colin King
  2019-12-04 12:56 ` Daniel Baluta
@ 2019-12-04 19:13 ` Pierre-Louis Bossart
  2019-12-25  0:09 ` Applied "ASoC: SOF: imx8: fix memory allocation failure check on priv->pd_dev" to the asoc tree Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Pierre-Louis Bossart @ 2019-12-04 19:13 UTC (permalink / raw)
  To: Colin King, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team, Daniel Baluta, alsa-devel,
	linux-arm-kernel
  Cc: kernel-janitors, linux-kernel



On 12/4/19 6:48 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The memory allocation failure check for priv->pd_dev is incorrectly
> pointer checking priv instead of priv->pd_dev. Fix this.
> 
> Addresses-Coverity: ("Logically dead code")
> Fixes: 202acc565a1f ("ASoC: SOF: imx: Add i.MX8 HW support")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Thanks Colin

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

> ---
>   sound/soc/sof/imx/imx8.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
> index cfefcfd92798..9d926b1df0d7 100644
> --- a/sound/soc/sof/imx/imx8.c
> +++ b/sound/soc/sof/imx/imx8.c
> @@ -209,7 +209,7 @@ static int imx8_probe(struct snd_sof_dev *sdev)
>   
>   	priv->pd_dev = devm_kmalloc_array(&pdev->dev, priv->num_domains,
>   					  sizeof(*priv->pd_dev), GFP_KERNEL);
> -	if (!priv)
> +	if (!priv->pd_dev)
>   		return -ENOMEM;
>   
>   	priv->link = devm_kmalloc_array(&pdev->dev, priv->num_domains,
> 

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

* Applied "ASoC: SOF: imx8: fix memory allocation failure check on priv->pd_dev" to the asoc tree
  2019-12-04 12:48 [PATCH] ASoC: SOF: imx8: fix memory allocation failure check on priv->pd_dev Colin King
  2019-12-04 12:56 ` Daniel Baluta
  2019-12-04 19:13 ` [alsa-devel] " Pierre-Louis Bossart
@ 2019-12-25  0:09 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2019-12-25  0:09 UTC (permalink / raw)
  To: Colin Ian King
  Cc: alsa-devel, Daniel Baluta, Fabio Estevam, Jaroslav Kysela,
	kernel-janitors, Liam Girdwood, linux-arm-kernel, linux-kernel,
	Mark Brown, NXP Linux Team, Pengutronix Kernel Team,
	Pierre-Louis Bossart, Sascha Hauer, Shawn Guo, Takashi Iwai

The patch

   ASoC: SOF: imx8: fix memory allocation failure check on priv->pd_dev

has been applied to the asoc tree at

   https://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 98910e1d61384430a080b4bcf986c3b0cf3fdf46 Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.king@canonical.com>
Date: Wed, 4 Dec 2019 12:48:16 +0000
Subject: [PATCH] ASoC: SOF: imx8: fix memory allocation failure check on
 priv->pd_dev

The memory allocation failure check for priv->pd_dev is incorrectly
pointer checking priv instead of priv->pd_dev. Fix this.

Addresses-Coverity: ("Logically dead code")
Fixes: 202acc565a1f ("ASoC: SOF: imx: Add i.MX8 HW support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191204124816.1415359-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/imx/imx8.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
index cfefcfd92798..9d926b1df0d7 100644
--- a/sound/soc/sof/imx/imx8.c
+++ b/sound/soc/sof/imx/imx8.c
@@ -209,7 +209,7 @@ static int imx8_probe(struct snd_sof_dev *sdev)
 
 	priv->pd_dev = devm_kmalloc_array(&pdev->dev, priv->num_domains,
 					  sizeof(*priv->pd_dev), GFP_KERNEL);
-	if (!priv)
+	if (!priv->pd_dev)
 		return -ENOMEM;
 
 	priv->link = devm_kmalloc_array(&pdev->dev, priv->num_domains,
-- 
2.20.1


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

end of thread, other threads:[~2019-12-25  0:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-04 12:48 [PATCH] ASoC: SOF: imx8: fix memory allocation failure check on priv->pd_dev Colin King
2019-12-04 12:56 ` Daniel Baluta
2019-12-04 19:13 ` [alsa-devel] " Pierre-Louis Bossart
2019-12-25  0:09 ` Applied "ASoC: SOF: imx8: fix memory allocation failure check on priv->pd_dev" to the asoc tree 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).