[PATCH v8 07/14] ARM: dts: rockchip: add clocks in iommu nodes

Robin Murphy robin.murphy at arm.com
Mon Apr 9 08:53:01 PDT 2018


On 09/04/18 16:44, Heiko Stübner wrote:
> Hi Tomeu,
> 
> Am Montag, 9. April 2018, 16:41:56 CEST schrieb Tomeu Vizoso:
>> in today's linux-next, the DRM driver fails to probe because the iommu
>> driver fails to find the aclk. I need to apply this patch for things
>> to work again.
> 
> Thanks for catching that issue.
> 
> This seems to expose a backwards-compatibility issue, as this breaks
> all old devicetrees, so should get a proper fix, apart from me applying
> the dt-patch I missed.
> 
> Looking at the iommu-clock-handling patch, I imagine this part as
> the culprit:
> 
> +	iommu->num_clocks = ARRAY_SIZE(rk_iommu_clocks);
> +	iommu->clocks = devm_kcalloc(iommu->dev, iommu->num_clocks,
> +				     sizeof(*iommu->clocks), GFP_KERNEL);
> +	if (!iommu->clocks)
> +		return -ENOMEM;
> 
> The clk-bulk functions seem to work with simple for loops and
> should (as the other standard clock functions) just work fine with
> an empty struct, so I guess a simple
> 
> 	if (!iommu->clocks && iommu->num_clocks > 0)
> 		return -ENOMEM;
> 
> should hopefully be enough. I'll try to give this a test later on
> if nobody beats me to it :-)

But iommu->num_clocks is clearly set to a nonzero compile-time constant 
at this point ;)

I'd assume it's the return from devm_clk_bulk_get() which needs to 
special-case the "no clocks found" case from any other error, and *then* 
blat num_clocks to 0 if so.

Robin.



More information about the linux-arm-kernel mailing list