diff mbox series

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

Message ID d973fbc962f750ef87c0bccf7b2df6536c8e987f.1505971045.git.arvind.yadav.cs@gmail.com (mailing list archive)
State Not Applicable
Headers show
Series None | expand

Commit Message

Arvind Yadav Sept. 21, 2017, 5:20 a.m. UTC
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(+)

Comments

Mark Brown Sept. 21, 2017, 3:18 p.m. UTC | #1
On Thu, Sep 21, 2017 at 10:50:03AM +0530, Arvind Yadav wrote:
> devm_kasprintf() can fail here and we must check its return value.

This is patch 2/3 but you've only sent me this one patch.  This is
missing the point of numbering a series, the only reason for the
numbering is to provide ordering within the series.  If you send a patch
separately or as part of a different series then the numbering should
change to reflect how things are being sent.
diff mbox series

Patch

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;