aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhen Lei <thunder.leizhen@huawei.com>2017-02-03 04:35:02 -0500
committerJoerg Roedel <jroedel@suse.de>2017-02-06 08:06:42 -0500
commit909111ba0ba6aa228d9b6e9cf01dd68a46586cb4 (patch)
tree4f129bfa5f167e88f6ce3971dd0d502ca63cea32
parenta1831bb9403720db6d4c033fe2d6bd0116dd28fe (diff)
iommu: Avoid unnecessary assignment of dev->iommu_fwspec
Move the assignment statement into if branch above, where it only needs to be. Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Reviewed-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r--drivers/iommu/iommu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index f4a176e56e39..428455a21ee7 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1869,13 +1869,14 @@ int iommu_fwspec_add_ids(struct device *dev, u32 *ids, int num_ids)
1869 fwspec = krealloc(dev->iommu_fwspec, size, GFP_KERNEL); 1869 fwspec = krealloc(dev->iommu_fwspec, size, GFP_KERNEL);
1870 if (!fwspec) 1870 if (!fwspec)
1871 return -ENOMEM; 1871 return -ENOMEM;
1872
1873 dev->iommu_fwspec = fwspec;
1872 } 1874 }
1873 1875
1874 for (i = 0; i < num_ids; i++) 1876 for (i = 0; i < num_ids; i++)
1875 fwspec->ids[fwspec->num_ids + i] = ids[i]; 1877 fwspec->ids[fwspec->num_ids + i] = ids[i];
1876 1878
1877 fwspec->num_ids += num_ids; 1879 fwspec->num_ids += num_ids;
1878 dev->iommu_fwspec = fwspec;
1879 return 0; 1880 return 0;
1880} 1881}
1881EXPORT_SYMBOL_GPL(iommu_fwspec_add_ids); 1882EXPORT_SYMBOL_GPL(iommu_fwspec_add_ids);