Message ID | 1499333825-7658-2-git-send-email-vivek.gautam@codeaurora.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CCD3B60317 for <patchwork-linux-arm@patchwork.kernel.org>; Thu, 6 Jul 2017 09:37:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDBFF283C0 for <patchwork-linux-arm@patchwork.kernel.org>; Thu, 6 Jul 2017 09:37:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B235F2847B; Thu, 6 Jul 2017 09:37:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 398B7283C0 for <patchwork-linux-arm@patchwork.kernel.org>; Thu, 6 Jul 2017 09:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=GFGFWVWU7VK7j9Y9CvY4gTg9l1B6Z7a+IKeyUhP19ok=; b=Afqe1xCgfJinQvm5KDsUORYc6B f0iEg5Nf+mdnBGGbWdQxdLtvpqaza4YTsosOu6tecgQbAbjatbsaTK1KL39CvfGnnQUQ5tq5+t2bV 5dik2wUjuB1fiCUHSmajYm+eEmd4ZN1ZqlYYsn59nguz8Tshy3nsWbN0MdwDdcfaaZvZ7WDGrE4rH uyBRVz87SXabB8R13BJSDYD5j/LPiX+XGhBjJ9gc8fXZeq+Q3EFKfwCbEB/DKeAAzMeEUlJyCspbs FPWAWkgJIwJkCIYA1wAWg6wN1QDEJIWEI01HqvfZxvtIUi7Za9BAKryKi/NHyn5YvaGWc3R7o68Gn 1PnNd9+A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dT3EH-0006q8-31; Thu, 06 Jul 2017 09:37:45 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dT3EC-0006l7-VP for linux-arm-kernel@lists.infradead.org; Thu, 06 Jul 2017 09:37:42 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2E41E60FF0; Thu, 6 Jul 2017 09:37:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1499333845; bh=nC0mbMvDiMO+kDQOSpcSiUeb0A5EqAXrvfhtUvsPV4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QDgmx1B3A3ZtRZHFJM5kGPEsRPDC4xsDzUBLbSAs5xaCgUAtCULdr6Y+MIXkSFjqN /0ntLVx83CFGamEjla7u5sUU99nCeSnEUPqewZC9UYKZOfA2fHi1BIWarau5LY8ppS 6fzsNllfy2ilM59SrFQnCOESoLB543xBSbPd8a3Q= Received: from blr-ubuntu-41.ap.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek.gautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id BE43B60723; Thu, 6 Jul 2017 09:37:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1499333844; bh=nC0mbMvDiMO+kDQOSpcSiUeb0A5EqAXrvfhtUvsPV4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=boIqqXQwZo8Ap8okgqpTMVFIU9swQxUtBR+/dKAbyZZFjviaUmFeo4/Vp2NsR3yFB NTF4cVxFrw0n84QjzOBV8rkbQ0ZBH2yZDXfFPlPka9L+5aIe/ublSsHRVbxBJVMsKh Wt+F2nfaEvjMmCd7l5wBAeDgLVS7dmUI2rum/iSQ= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org BE43B60723 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vivek.gautam@codeaurora.org From: Vivek Gautam <vivek.gautam@codeaurora.org> To: joro@8bytes.org, robin.murphy@arm.com, robh+dt@kernel.org, mark.rutland@arm.com, will.deacon@arm.com, m.szyprowski@samsung.com, sboyd@codeaurora.org, robdclark@gmail.com, iommu@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org Subject: [PATCH V4 1/6] iommu/arm-smmu: Fix the error path in arm_smmu_add_device Date: Thu, 6 Jul 2017 15:07:00 +0530 Message-Id: <1499333825-7658-2-git-send-email-vivek.gautam@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1499333825-7658-1-git-send-email-vivek.gautam@codeaurora.org> References: <1499333825-7658-1-git-send-email-vivek.gautam@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170706_023741_062220_166997CE X-CRM114-Status: GOOD ( 10.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Cc: architt@codeaurora.org, linux-arm-msm@vger.kernel.org, stanimir.varbanov@linaro.org, vivek.gautam@codeaurora.org, sricharan@codeaurora.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 9a45117d90de..61b1f8729a7c 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1349,15 +1349,15 @@ static int arm_smmu_add_device(struct device *dev) ret = arm_smmu_master_alloc_smes(dev); if (ret) - goto out_free; + goto out_cfg_free; iommu_device_link(&smmu->iommu, dev); return 0; +out_cfg_free: + kfree(cfg); out_free: - if (fwspec) - kfree(fwspec->iommu_priv); iommu_fwspec_free(dev); return ret; }
fwspec->iommu_priv is available only after arm_smmu_master_cfg instance has been allocated. We shouldn't free it before that. Also it's logical to free the master cfg itself without checking for fwspec. Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org> --- drivers/iommu/arm-smmu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)