From patchwork Wed Jan 15 05:55:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 23214 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 75133202FA for ; Wed, 15 Jan 2014 05:59:32 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id vb8sf2117425obc.6 for ; Tue, 14 Jan 2014 21:59:31 -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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=++v5OOb7sOcRtvrsT68aeutQZpcDuR4c5Y5R9ppTb1k=; b=ZNudVVyjtYpxNnwFGF1jO842gqwQDqDwBzdhipNZHQJ+UZsjJL3ODujunsapGyyAOh 2GreZBLGtzCgTEpv+cKp80AvbskAThTXqYoFie9vh/pjnUlqhAzea750Jqc+/soCSdmD +m3S0Ae5fBj1A84ewLoEloGTdAARX/tD32Iq9WWYHLk10zCWEdbvlp+3KG/QfihkvvVg YlXLz92QQ6Df/Nh/H0x/qVqY0Rwmr7QntOSvyLZW4z8y2mRAhla0CYioGHMrd3eG6p3g ZXDDGmeOWC0L5/2lA5qWBo7IWNtTA/7wMaLq+m4FVnLrtpf8OBoZbkWyEQJSxTuFWUj3 3E4Q== X-Gm-Message-State: ALoCoQm1TtZHJc7SbZ9Hnrb94cRJHotlwFTrIeZcAAJF53UfYTYX3kVFlKb3gETbv+Hv36XRCJTI X-Received: by 10.182.33.6 with SMTP id n6mr129377obi.6.1389765571593; Tue, 14 Jan 2014 21:59:31 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.76.72 with SMTP id i8ls477636qew.59.gmail; Tue, 14 Jan 2014 21:59:31 -0800 (PST) X-Received: by 10.52.236.132 with SMTP id uu4mr120720vdc.47.1389765571511; Tue, 14 Jan 2014 21:59:31 -0800 (PST) Received: from mail-vb0-f51.google.com (mail-vb0-f51.google.com [209.85.212.51]) by mx.google.com with ESMTPS id tc7si1176429vdc.22.2014.01.14.21.59.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Jan 2014 21:59:31 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.51 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.51; Received: by mail-vb0-f51.google.com with SMTP id 11so230167vbe.24 for ; Tue, 14 Jan 2014 21:59:31 -0800 (PST) X-Received: by 10.52.185.132 with SMTP id fc4mr134613vdc.21.1389765571432; Tue, 14 Jan 2014 21:59:31 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp251004ved; Tue, 14 Jan 2014 21:59:30 -0800 (PST) X-Received: by 10.66.226.46 with SMTP id rp14mr277926pac.133.1389765570510; Tue, 14 Jan 2014 21:59:30 -0800 (PST) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by mx.google.com with ESMTPS id pk8si2636193pab.242.2014.01.14.21.59.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Jan 2014 21:59:30 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.50 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.220.50; Received: by mail-pa0-f50.google.com with SMTP id kp14so689830pab.9 for ; Tue, 14 Jan 2014 21:59:30 -0800 (PST) X-Received: by 10.66.51.137 with SMTP id k9mr384706pao.11.1389765570129; Tue, 14 Jan 2014 21:59:30 -0800 (PST) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id kk1sm5423001pbd.22.2014.01.14.21.59.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 14 Jan 2014 21:59:29 -0800 (PST) From: Sachin Kamat To: linux-mmc@vger.kernel.org Cc: chris@printf.net, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 3/9] mmc: sdhci-spear: Fix NULL pointer dereference Date: Wed, 15 Jan 2014 11:25:07 +0530 Message-Id: <1389765313-16744-3-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1389765313-16744-1-git-send-email-sachin.kamat@linaro.org> References: <1389765313-16744-1-git-send-email-sachin.kamat@linaro.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.212.51 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: 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