Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp208617iob; Mon, 2 May 2022 17:15:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7vPKTyMsB5XSewu0k8oo5JT/T1l0tBiad8qGNYNSa8E7ClTaibiLGm7ZjAgX6Kg7mF7+G X-Received: by 2002:a63:4004:0:b0:39d:8634:fff2 with SMTP id n4-20020a634004000000b0039d8634fff2mr11624918pga.28.1651536936956; Mon, 02 May 2022 17:15:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651536936; cv=none; d=google.com; s=arc-20160816; b=OJ84MwQUslbKX0cB8et8toviynm2ba7wSyWJ7HW6gin4oDwCrbFk/zUDlzura/uE5Z TaR6cfK6A2C//Hyo5LhzAEM8ghxbLyaEwuOD4bNfc9A9WjOqdvwwJM3SNqdipXptbKsk f/9MOv1Q5kLbyUWaXy1t5a3R74YGIYtjULak2oBVVRXvjFJy2oyMGQyMh4LtnFAhLmUs a+kzLCBPtpPDojiAAuM7Bt8ulbvPkQA67eBdi0bf2pe0N3v/3xT+hoZzHCJ1Fbjtx33f gAUkv+9BydGnrB3WgOPhfP0IHWgtBTion9R3xsKZnpy9iKv+pojtshVMxQ7wPhbU7OYk fYOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ZohBTUQ/LZbS+o8W/VtMK+1Flcbn9HfcCfSB3a36VjI=; b=jZ2gzXdVne7t63JKY3DFBWgwqjajaPCQ7NZznIcywz/OX5Alp/YhWowC8XvJwMGNAZ 9oSLhebgus54mULJ+W3CKeSuSJp4fIcwyGBIsJ4Df5nT5mHpA2BMhdu8stpnwOKdjOYF kOyGLYXNpx/iIlzPjXFd3frsuYHKG5n+fq8yk6cVBlXyxOAfTAI6tr1LrmQUoXYZb62w atD1o5SBs9JEX+CdQzGnjRU+XovSQPXzZgyFFlUveca4M4vB+bmRwgXxVvTHA6ErouAz Z+M6gCy8UiSFABNI8PIeZrLU0NJNAMI125IXlaVwzT+tGuClF3xiQ7D+BCcPFFlrvjqH ptmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BafF1IEZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j192-20020a638bc9000000b003aae4f1097asi14884734pge.559.2022.05.02.17.15.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 17:15:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BafF1IEZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 02BDF37A33; Mon, 2 May 2022 17:13:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377916AbiD2P0X (ORCPT + 99 others); Fri, 29 Apr 2022 11:26:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234758AbiD2P0W (ORCPT ); Fri, 29 Apr 2022 11:26:22 -0400 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0BEE689A4 for ; Fri, 29 Apr 2022 08:23:02 -0700 (PDT) Received: by mail-yb1-xb33.google.com with SMTP id d12so15071584ybc.4 for ; Fri, 29 Apr 2022 08:23:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZohBTUQ/LZbS+o8W/VtMK+1Flcbn9HfcCfSB3a36VjI=; b=BafF1IEZ4EDjsmtHXSsqVqrWZ8g2k5/kH6HfKliDsRHA43hy2G2+BtITONBujNnLl9 pLCwWahreUD6kBQmDFxL/MzrUF0SJKzdT/cKllJHdTRWb5qoZklkD+LOMU/Puy0duaUM tv/CORBR7bOo+VfJBEVTa+rKyibTdw/wMAm9z9NPYT9FtqdEgYGun76+4YC3DHL6w+Qv ykVgZ7jE7iJiTDJpDE3DWRI2b/JThT+f6qMZa2+6nWbcBORWWE0j5suB4MoRBxf0kKra AdbtXHGo3Z5u/a2Gy8oPTmfyx52K719oDWDFhyg6pDvC5WfJAH1lGIzAr7xaacOafkSE /PSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZohBTUQ/LZbS+o8W/VtMK+1Flcbn9HfcCfSB3a36VjI=; b=cVLKSHuP804J6tYS4MDpG5nX7GhKQxjF3iuYF1NiEBYQo+7XkxHmAtAH70ruARbyfe nLliOto5Rj+cRmQMdNy7avRzYiDIVzw3/W6yLdTNizXvFcPZKUK1RNhcepWpmpFECk5y NXDgCyybMZRLKxICPRkzlQINZrRWcg7+ahh6peKYyzYqZVCDsewXB+66wRT4rvBhALTm 0sHYkS07daHGtK6C4TMySKJD6d7WMetxgv0f4ytPPfwDKEIVTvD04Xee3ais1mD/2okV 7RowAPJzvJGAcCpVG78TO4CDTcC61KUhT+5LVb13rKQHygoH6zWVVQENxJx8RVnmSIq9 XPMg== X-Gm-Message-State: AOAM532GPMdK2dW1PN3ECA+hzRDHtTotYevOhR4jgsC9nR9cugGYGHqV 7NO5EA69M6NY78iFEaeTIq6Rfz6mpee9gY2DFHW7OA== X-Received: by 2002:a25:a1c6:0:b0:641:5ff5:9f93 with SMTP id a64-20020a25a1c6000000b006415ff59f93mr36532265ybi.49.1651245782234; Fri, 29 Apr 2022 08:23:02 -0700 (PDT) MIME-Version: 1.0 References: <20220429120108.9396-1-ansuelsmth@gmail.com> <20220429120108.9396-4-ansuelsmth@gmail.com> <626bff7e.1c69fb81.bdf89.4da7@mx.google.com> In-Reply-To: <626bff7e.1c69fb81.bdf89.4da7@mx.google.com> From: Dmitry Baryshkov Date: Fri, 29 Apr 2022 18:22:50 +0300 Message-ID: Subject: Re: [PATCH 3/4] clk: qcom: clk-krait: add hw_parent check for div2_round_rate To: Ansuel Smith Cc: Andy Gross , Bjorn Andersson , Michael Turquette , Stephen Boyd , Sricharan R , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 29 Apr 2022 at 18:08, Ansuel Smith wrote: > > On Fri, Apr 29, 2022 at 05:53:32PM +0300, Dmitry Baryshkov wrote: > > On 29/04/2022 15:01, Ansuel Smith wrote: > > > Check if hw_parent is present before calculating the round_rate to > > > prevent kernel panic. On error -EINVAL is reported. > > > > > > Signed-off-by: Ansuel Smith > > > > I see that other clock drivers do not perform this check. Which path leads > > to this oops? > > > > This comes from qsdk patches so I apologize in advance about this. Ugh. If it comes from the code authored by somebody else, it'd be better to note this (by using the From or Co-developed-by tags). At the very least (if the author is unknown) you can mention the origin of the patch (qsdk) in the commit message. > > Anyway I'm checking the code and krait-cc is the only user of > krait_div2_clk_ops. That user have as parent only hfpll_something that > is declared by gcc. Now hfpll can also be declared in dts with a > dedicated driver so I wonder if the problem is there in the case when > hfpll is declared in dts and is probed after krait-cc. This is not the > case for ipq8064 but I wonder if qsdk have other krait based device that > have a configuration with hfpll declared in dts. On msm8974 (and maybe others) the hfpll should be driven by the separate hfpll driver. > > In short you are right and in our current code the check is uselss and > I'm positive about dropping this patch but I do wonder if downstream > there is an actual use of this. Don't know how to proceed. Any hint? I'd say, let's drop it for now unless Stephen or Bjorn tell us that it's a valid check. > > > > --- > > > drivers/clk/qcom/clk-krait.c | 7 ++++++- > > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/clk/qcom/clk-krait.c b/drivers/clk/qcom/clk-krait.c > > > index 90046428693c..6c367ad6506a 100644 > > > --- a/drivers/clk/qcom/clk-krait.c > > > +++ b/drivers/clk/qcom/clk-krait.c > > > @@ -84,7 +84,12 @@ EXPORT_SYMBOL_GPL(krait_mux_clk_ops); > > > static long krait_div2_round_rate(struct clk_hw *hw, unsigned long rate, > > > unsigned long *parent_rate) > > > { > > > - *parent_rate = clk_hw_round_rate(clk_hw_get_parent(hw), rate * 2); > > > + struct clk_hw *hw_parent = clk_hw_get_parent(hw); > > > + > > > + if (!hw_parent) > > > + return -EINVAL; > > > + > > > + *parent_rate = clk_hw_round_rate(hw_parent, rate * 2); > > > return DIV_ROUND_UP(*parent_rate, 2); > > > } > > > > > > -- > > With best wishes > > Dmitry > > -- > Ansuel -- With best wishes Dmitry