OSDN Git Service

iommu: arm-smmu: Allow configurations with zero clocks
authorPatrick Daly <pdaly@codeaurora.org>
Thu, 13 Oct 2016 05:15:36 +0000 (22:15 -0700)
committerPatrick Daly <pdaly@codeaurora.org>
Sat, 21 Jan 2017 00:02:05 +0000 (16:02 -0800)
If no clocks are present in devicetree, ensure that smmu->num_clocks is
set to zero instead of an error value.

Change-Id: Ibc3ede250419dd0235f3aa481218e3a91cdb3630
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
drivers/iommu/arm-smmu.c

index 70766e2..fbe2302 100644 (file)
@@ -3531,8 +3531,10 @@ static int arm_smmu_init_clocks(struct arm_smmu_device *smmu)
        smmu->num_clocks =
                of_property_count_strings(dev->of_node, "clock-names");
 
-       if (smmu->num_clocks < 1)
+       if (smmu->num_clocks < 1) {
+               smmu->num_clocks = 0;
                return 0;
+       }
 
        smmu->clocks = devm_kzalloc(
                dev, sizeof(*smmu->clocks) * smmu->num_clocks,