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


Groups > linux.kernel > #1736364

[PATCH v2 2/3] ASoC: fsl-asoc-card: Handle return value of devm_kasprintf

From Arvind Yadav <arvind.yadav.cs@gmail.com>
Newsgroups linux.kernel
Subject [PATCH v2 2/3] ASoC: fsl-asoc-card: Handle return value of devm_kasprintf
Date 2017-09-21 07:30 +0200
Message-ID <us2dH-4YL-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


devm_kasprintf() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
changes in v2:
               Set return 'ret' to -ENOMEM.

 sound/soc/fsl/fsl-asoc-card.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index 2db4d0c..a389885 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -639,6 +639,10 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
 				devm_kasprintf(&pdev->dev, GFP_KERNEL,
 					       "ac97-codec.%u",
 					       (unsigned int)idx);
+		if (!priv->dai_link[0].codec_name) {
+			ret = -ENOMEM;
+			goto asrc_fail;
+		}
 	}
 
 	priv->dai_link[0].platform_of_node = cpu_np;
-- 
1.9.1

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


Thread

[PATCH v2 2/3] ASoC: fsl-asoc-card: Handle return value of devm_kasprintf Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-09-21 07:30 +0200
  Re: [PATCH v2 2/3] ASoC: fsl-asoc-card: Handle return value of  devm_kasprintf Mark Brown <broonie@kernel.org> - 2017-09-21 17:20 +0200
  Applied "ASoC: fsl-asoc-card: Handle return value of devm_kasprintf" to the asoc tree Mark Brown <broonie@kernel.org> - 2017-09-21 18:00 +0200

csiph-web