From patchwork Fri Feb 3 09:35:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 93150 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp510093qgi; Fri, 3 Feb 2017 01:35:53 -0800 (PST) X-Received: by 10.84.174.1 with SMTP id q1mr19847753plb.19.1486114553819; Fri, 03 Feb 2017 01:35:53 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1si17581949pgn.306.2017.02.03.01.35.53; Fri, 03 Feb 2017 01:35:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752847AbdBCJfv (ORCPT + 25 others); Fri, 3 Feb 2017 04:35:51 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:35746 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752605AbdBCJft (ORCPT ); Fri, 3 Feb 2017 04:35:49 -0500 Received: from 172.24.1.60 (EHLO szxeml422-hub.china.huawei.com) ([172.24.1.60]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DUB00970; Fri, 03 Feb 2017 17:35:44 +0800 (CST) Received: from localhost (10.177.23.164) by szxeml422-hub.china.huawei.com (10.82.67.152) with Microsoft SMTP Server id 14.3.235.1; Fri, 3 Feb 2017 17:35:36 +0800 From: Zhen Lei To: Joerg Roedel , iommu , linux-kernel CC: Zefan Li , Xinwei Hu , "Tianhong Ding" , Hanjun Guo , Zhen Lei Subject: [PATCH 1/1] iommu: to avoid an unnecessary assignment Date: Fri, 3 Feb 2017 17:35:02 +0800 Message-ID: <1486114502-10984-1-git-send-email-thunder.leizhen@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.177.23.164] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.58944EF1.0271, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: cb82120d1b6cffb4f9a2e59dd7fb14b0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move the assignment statement into if branch above, where it only needs to be. Signed-off-by: Zhen Lei --- drivers/iommu/iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.5.0 Reviewed-by: Robin Murphy diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index dbe7f65..b231400 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -1714,13 +1714,14 @@ int iommu_fwspec_add_ids(struct device *dev, u32 *ids, int num_ids) fwspec = krealloc(dev->iommu_fwspec, size, GFP_KERNEL); if (!fwspec) return -ENOMEM; + + dev->iommu_fwspec = fwspec; } for (i = 0; i < num_ids; i++) fwspec->ids[fwspec->num_ids + i] = ids[i]; fwspec->num_ids += num_ids; - dev->iommu_fwspec = fwspec; return 0; } EXPORT_SYMBOL_GPL(iommu_fwspec_add_ids);