Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751715AbdIUFVE (ORCPT ); Thu, 21 Sep 2017 01:21:04 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35515 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751524AbdIUFVC (ORCPT ); Thu, 21 Sep 2017 01:21:02 -0400 X-Google-Smtp-Source: AOwi7QDtX4sLw9HPcHVkVgDeq/rLX23iJ0sPuNE3qIkDzjKRbMEkhbsu0MOXC82RYz0N8R97NJdyWw== From: Arvind Yadav To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, timur@tabi.org, nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, fabio.estevam@nxp.com, peter.ujfalusi@ti.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, linux-omap@vger.kernel.org Subject: [PATCH v2 2/3] ASoC: fsl-asoc-card: Handle return value of devm_kasprintf Date: Thu, 21 Sep 2017 10:50:03 +0530 Message-Id: X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 775 Lines: 27 devm_kasprintf() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- 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