From patchwork Tue Feb 25 09:48:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 25270 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C908320543 for ; Tue, 25 Feb 2014 09:54:36 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id vb8sf34041601obc.9 for ; Tue, 25 Feb 2014 01:54:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=3GY2aXS+2cWX47JcbYxZ7KbKYDCbMPB7+tAAE7maVxc=; b=MijFz9pMwrHTKR2+vEIA7ZOb8itVJeb4+YOQobbiGds4ouH0PXVERo+hM0z8BXMQPN F3dF/jq4fAKZw4j5oyxo1JU+yHnDX0AZRtS7ISk4Feb/tQv5GxFY8rp1VHmSPYqJIKi3 +r+qgXrycT+hTb1Lx308K8wLGwKejCXFWD/Jb/XEwdl0OBAMF1xj3SEuFrGR6mPfEbpW RNxzWnEtlopEjTtEoeAwjrpunKDmDQ96/omoaoE93z3XL81LOcbzucfFKvKE8Tx59ef+ zLIQPu7tDAONXUrhA0iQq0YKv0hdnO3ixvhW4+Q0RO8T2d+rC+2ji0mGdXRX6kpkhN4V o1ng== X-Gm-Message-State: ALoCoQl3dUuwrXvuIBrlvKVLwzXDTp8A+lPbFDBwDDi00idhiiqQuFCpttvOCP0J1bT7rD/HEdSM X-Received: by 10.50.222.103 with SMTP id ql7mr11685269igc.1.1393322076361; Tue, 25 Feb 2014 01:54:36 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.96.52 with SMTP id j49ls2309720qge.7.gmail; Tue, 25 Feb 2014 01:54:36 -0800 (PST) X-Received: by 10.58.255.233 with SMTP id at9mr317643ved.20.1393322076264; Tue, 25 Feb 2014 01:54:36 -0800 (PST) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id wz4si6663051vdc.59.2014.02.25.01.54.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Feb 2014 01:54:36 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id id10so7098593vcb.27 for ; Tue, 25 Feb 2014 01:54:36 -0800 (PST) X-Received: by 10.52.230.105 with SMTP id sx9mr273665vdc.10.1393322076191; Tue, 25 Feb 2014 01:54:36 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp125503vcz; Tue, 25 Feb 2014 01:54:35 -0800 (PST) X-Received: by 10.66.149.7 with SMTP id tw7mr710622pab.72.1393322067172; Tue, 25 Feb 2014 01:54:27 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xn1si3064032pbc.128.2014.02.25.01.54.26; Tue, 25 Feb 2014 01:54:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750768AbaBYJyY (ORCPT + 7 others); Tue, 25 Feb 2014 04:54:24 -0500 Received: from mail-pd0-f177.google.com ([209.85.192.177]:61287 "EHLO mail-pd0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751955AbaBYJyX (ORCPT ); Tue, 25 Feb 2014 04:54:23 -0500 Received: by mail-pd0-f177.google.com with SMTP id g10so1910440pdj.8 for ; Tue, 25 Feb 2014 01:54:22 -0800 (PST) X-Received: by 10.66.241.73 with SMTP id wg9mr589883pac.69.1393322054436; Tue, 25 Feb 2014 01:54:14 -0800 (PST) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id qq5sm8804447pbb.24.2014.02.25.01.54.11 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Feb 2014 01:54:13 -0800 (PST) From: Sachin Kamat To: linux-mmc@vger.kernel.org Cc: ulf.hansson@linaro.org, chris@printf.net, sachin.kamat@linaro.org Subject: [PATCH 03/10] mmc: sdhci-spear: Fix NULL pointer dereference Date: Tue, 25 Feb 2014 15:18:21 +0530 Message-Id: <1393321708-9719-3-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1393321708-9719-1-git-send-email-sachin.kamat@linaro.org> References: <1393321708-9719-1-git-send-email-sachin.kamat@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sachin.kamat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , pdata could be NULL if cd_gpio = -1. Dereference pdata only if it is not NULL. Signed-off-by: Sachin Kamat Acked-by: Viresh Kumar --- drivers/mmc/host/sdhci-spear.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c index 2dba9f8d1760..76ddd89a688e 100644 --- a/drivers/mmc/host/sdhci-spear.c +++ b/drivers/mmc/host/sdhci-spear.c @@ -84,14 +84,12 @@ static struct sdhci_plat_data *sdhci_probe_config_dt(struct platform_device *pde /* If pdata is required */ if (cd_gpio != -1) { pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) { + if (!pdata) dev_err(&pdev->dev, "DT: kzalloc failed\n"); - return ERR_PTR(-ENOMEM); - } + else + pdata->card_int_gpio = cd_gpio; } - pdata->card_int_gpio = cd_gpio; - return pdata; } #else