From patchwork Wed May 20 04:50:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajan Vaja X-Patchwork-Id: 6452241 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 31A13C0432 for ; Thu, 21 May 2015 05:33:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 41F1E20443 for ; Thu, 21 May 2015 05:33:15 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id C090420426 for ; Thu, 21 May 2015 05:33:13 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id B8FC4265815; Thu, 21 May 2015 07:33:12 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 2331D260676; Thu, 21 May 2015 07:32:07 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id DF8CF260453; Wed, 20 May 2015 06:51:13 +0200 (CEST) Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by alsa0.perex.cz (Postfix) with ESMTP id B55E826043E for ; Wed, 20 May 2015 06:51:06 +0200 (CEST) Received: by padbw4 with SMTP id bw4so52771841pad.0 for ; Tue, 19 May 2015 21:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=qBUFpFTu8pyRxPEzJZtszrN6iCT9XZTeL6cO77Zq+j8=; b=Vp6oN8c6Dr7IqQ9J0c1Sg4onB5LSYIeLBVlaGzyey8dOZMidedeuYuAKw+XOqEv0ne esA02ieFvvZYu2u+fHocbS6kVoSSyH2P/5gGVSXVcPPJHL8GIj4eYRH1AC+el3fP7k1K 9b+FYyIoLM6NybA8VnPKXJrtGxPgAKeaKZUTcYcULzF97gQ1i9eJMkBEJZ0uPIY5AKr/ uEKrS+BJfJVpY7QtBYC9rABSXh1R/26yR0yqg7RoNWfbHSvJ8iS5LEq3KaC7uUnkqDYa ezag0YwN7G37qpVFOUsOXjal5KTspEuQQ8MRIQRUtnykm4P8RxPfZUd1cNDaN6Yggr2O EzkA== X-Received: by 10.66.186.103 with SMTP id fj7mr50510220pac.132.1432097465058; Tue, 19 May 2015 21:51:05 -0700 (PDT) Received: from rajan.audience.local ([202.131.115.146]) by mx.google.com with ESMTPSA id cl11sm14634531pdb.36.2015.05.19.21.51.01 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 May 2015 21:51:04 -0700 (PDT) From: Rajan Vaja To: lgirdwood@gmail.com Date: Wed, 20 May 2015 10:20:54 +0530 Message-Id: <1432097454-3643-1-git-send-email-rajan.vaja@gmail.com> X-Mailer: git-send-email 1.7.9.5 X-Mailman-Approved-At: Thu, 21 May 2015 07:32:04 +0200 Cc: alsa-devel@alsa-project.org, rajan.vaja@gmail.com, lars@metafoo.de, tiwai@suse.de, broonie@kernel.org Subject: [alsa-devel] [PATCH] ASoC: mop500_ab8500: Add a NULL pointer check in mop500_ab8500_machine_init() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid possible crash (NULL pointer dereference) by making sure that dem_kzalloc() is successful. Signed-off-by: Rajan Vaja --- sound/soc/ux500/mop500_ab8500.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/ux500/mop500_ab8500.c b/sound/soc/ux500/mop500_ab8500.c index b81a7a4c..85d810d 100644 --- a/sound/soc/ux500/mop500_ab8500.c +++ b/sound/soc/ux500/mop500_ab8500.c @@ -372,6 +372,10 @@ int mop500_ab8500_machine_init(struct snd_soc_pcm_runtime *rtd) /* Create driver private-data struct */ drvdata = devm_kzalloc(dev, sizeof(struct mop500_ab8500_drvdata), GFP_KERNEL); + + if (!drvdata) + return -ENOMEM; + snd_soc_card_set_drvdata(rtd->card, drvdata); /* Setup clocks */