From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753240AbeDIPxK (ORCPT ); Mon, 9 Apr 2018 11:53:10 -0400 Received: from foss.arm.com ([217.140.101.70]:57912 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752314AbeDIPxI (ORCPT ); Mon, 9 Apr 2018 11:53:08 -0400 Subject: Re: [PATCH v8 07/14] ARM: dts: rockchip: add clocks in iommu nodes To: =?UTF-8?Q?Heiko_St=c3=bcbner?= , Tomeu Vizoso Cc: Jeffy Chen , open list , jcliang@chromium.org, simon xue , tfiga@chromium.org, Romain Perier , Yakir Yang , Arnd Bergmann , Liang Chen , Rob Herring , Shawn Lin , Catalin Marinas , David Wu , Finley Xiao , Enric Balletbo i Serra , Jacob Chen , Kever Yang , Brian Norris , "open list:ARM/Rockchip SoC..." , Rocky Hao , Will Deacon , Nickey Yang , devicetree@vger.kernel.org, Mark Yao , Russell King , linux-arm-kernel@lists.infradead.org, Sugar Zhang , Caesar Wang , Mark Rutland References: <20180323073814.5802-1-jeffy.chen@rock-chips.com> <20180323073814.5802-8-jeffy.chen@rock-chips.com> <10157755.JROavG9E9U@diego> From: Robin Murphy Message-ID: Date: Mon, 9 Apr 2018 16:53:01 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <10157755.JROavG9E9U@diego> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.