From patchwork Sat Feb 15 19:28:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 3656881 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D571BBF13A for ; Sat, 15 Feb 2014 19:29:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3602C201C8 for ; Sat, 15 Feb 2014 19:29:00 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D811A2017A for ; Sat, 15 Feb 2014 19:28:58 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id BD07F26168D; Sat, 15 Feb 2014 20:28:56 +0100 (CET) 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_SIGNED, FREEMAIL_FROM, NO_DNS_FOR_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 9413926163E; Sat, 15 Feb 2014 20:28:46 +0100 (CET) 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 D5DC5261643; Sat, 15 Feb 2014 20:28:44 +0100 (CET) Received: from smtp1.mail.ru (smtp1.mail.ru [94.100.176.129]) by alsa0.perex.cz (Postfix) with ESMTP id D77DB261629 for ; Sat, 15 Feb 2014 20:28:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=Message-Id:Date:Subject:Cc:To:From; bh=UiyvzNMeqpjlEpWlHeCxAd2zkr6/KkOhQ5i6jaUReds=; b=IRWsvNW9CvPD8OnYPGeX3oJ8hYsn8iJ20LeQbP1eVI6BhTeFrhhQa+WLXe71N9waFphtjmnCoGih87fFOzGHyC6ii5s3ody24a7CN1+wxgiGa3f3/q7hmZsrnbjtBh7xCWsqgk+w+tvJ6dMjWpD/13VfTrDtxR0uxWB7AHF1Vpg=; Received: from [188.134.40.128] (port=51574 helo=shc.zet) by smtp1.mail.ru with esmtpa (envelope-from ) id 1WEkui-0004vp-UX; Sat, 15 Feb 2014 23:28:37 +0400 From: Alexander Shiyan To: alsa-devel@alsa-project.org Date: Sat, 15 Feb 2014 23:28:29 +0400 Message-Id: <1392492509-29426-1-git-send-email-shc_work@mail.ru> X-Mailer: git-send-email 1.8.3.2 X-Spam: Not detected X-Mras: Ok Cc: Takashi Iwai , Mark Brown , Liam Girdwood , Alexander Shiyan Subject: [alsa-devel] [PATCH] ASoC: txx9aclc_ac97: Fix kernel crash on probe 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 This patch fixes a crash caused by commit af5b2d7519 (ASoC: txx9aclc_ac97: Convert to devm_ioremap_resource()). This is an attempt to assign "drvdata->base" while memory for "drvdata" is not already allocated. Signed-off-by: Alexander Shiyan --- sound/soc/txx9/txx9aclc-ac97.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/soc/txx9/txx9aclc-ac97.c b/sound/soc/txx9/txx9aclc-ac97.c index e0305a1..9edd68d 100644 --- a/sound/soc/txx9/txx9aclc-ac97.c +++ b/sound/soc/txx9/txx9aclc-ac97.c @@ -183,14 +183,16 @@ static int txx9aclc_ac97_dev_probe(struct platform_device *pdev) irq = platform_get_irq(pdev, 0); if (irq < 0) return irq; + + drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); drvdata->base = devm_ioremap_resource(&pdev->dev, r); if (IS_ERR(drvdata->base)) return PTR_ERR(drvdata->base); - drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); - if (!drvdata) - return -ENOMEM; platform_set_drvdata(pdev, drvdata); drvdata->physbase = r->start; if (sizeof(drvdata->physbase) > sizeof(r->start) &&