Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3396066ybp; Sun, 6 Oct 2019 11:01:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhKxB/DSQFn6AyK+L+bUK2komYX7mw+8zMlETaMYUPBkz8zyIFwI3JWFBa0Z/yDDFxnksb X-Received: by 2002:a50:ed82:: with SMTP id h2mr25632937edr.206.1570384880787; Sun, 06 Oct 2019 11:01:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570384880; cv=none; d=google.com; s=arc-20160816; b=sPuPNkinWHbdgjjmkqjUUxK265m6LDb74tsA54O9aKZ+wbVg8xOcB9xEHiq+B6Vwyz M4Ev6cXxKQntu8Umn3FUjuzS+oiBGM19PLV3F0pdGLtrvC6oJVA37kTpBpcoOr9oTA85 I2z1XmHN1qzHZrQK1lz86Fivc4Tg4Zstli38K1qTEoF2+HqCe2Ps8NII9xLDtXQaHlZB G8Hk+8F9rMjTaoBhE2hO+CFlGnzE5syQp11BnDIgwukB1SAuJ5hJJjvWF4LjN8dCGmIS +wjfAvdiu5RxT1C9LmG0/EHw909K9vhpl8GXK/+Q0xSSXPel15QlCGjCNasCEqb9Z98G igEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BTO6F9Z5EYepwxoBT9K/4s6d8S6VS9GIzB0aB/K1zEM=; b=IcIWXwilDjuqkoAwu3SKXYJP5fnBjhd5TuIWbXtB6WXdFrTbWjfG5pkmVM4WmmYEM7 JUjuyR87zOnq0Pza5Ii01jJYhbLWTbd6whr7p8MMn8FrRf6YgMPng5c7nfWGiG9YWL3M kW2YB++b1Nfzw6Jfk3Eb5nyJN9x6iCBlKt8jhBdmlyenRKJ+MqflKShmyVmC7sBx1Xjh Alys2YwHIPZtb9OBwOmmK9U+TqXTRXkNf8IlX5TxhBtHk3ZuphCOdru8wTKCme8w3i4q I2yJU5zm710UqtdvU/zKMt9qQsrtxQ0I4mRPUJJl4Ypt/AAHtrxieo73k60JnOElfDaq pX+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KfRhGgmP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h26si7597701edb.141.2019.10.06.11.00.56; Sun, 06 Oct 2019 11:01:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KfRhGgmP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728031AbfJFSAl (ORCPT + 99 others); Sun, 6 Oct 2019 14:00:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:54284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727786AbfJFR2h (ORCPT ); Sun, 6 Oct 2019 13:28:37 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 45ED92080F; Sun, 6 Oct 2019 17:28:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570382916; bh=QupKWh7rUQgJ8ktqyzVPLYtsgPGbrWH0XN6BQUvicMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KfRhGgmPG0zejX+fgKRlOirRMCk9MmE+xNFxiTIefV/xwRHqeJvIqh2k/wT3w0uVj 3ZsGQXkLb7iZTWsCkaPHkcdHMZ0uKVYnhCJnlN/IM72cLYWocA+f7O977uTp8mlb9P 095mX9ookbVsA79CD9hzLPiu45hvYV42rvIGTj1o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guo Zeng , Barry Song , Stephen Boyd , Sasha Levin Subject: [PATCH 4.19 019/106] clk: sirf: Dont reference clk_init_data after registration Date: Sun, 6 Oct 2019 19:20:25 +0200 Message-Id: <20191006171133.286486882@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191006171124.641144086@linuxfoundation.org> References: <20191006171124.641144086@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephen Boyd [ Upstream commit af55dadfbce35b4f4c6247244ce3e44b2e242b84 ] A future patch is going to change semantics of clk_register() so that clk_hw::init is guaranteed to be NULL after a clk is registered. Avoid referencing this member here so that we don't run into NULL pointer exceptions. Cc: Guo Zeng Cc: Barry Song Signed-off-by: Stephen Boyd Link: https://lkml.kernel.org/r/20190731193517.237136-6-sboyd@kernel.org Signed-off-by: Sasha Levin --- drivers/clk/sirf/clk-common.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/clk/sirf/clk-common.c b/drivers/clk/sirf/clk-common.c index d8f9efa5129ad..25351d6a55ba2 100644 --- a/drivers/clk/sirf/clk-common.c +++ b/drivers/clk/sirf/clk-common.c @@ -298,9 +298,10 @@ static u8 dmn_clk_get_parent(struct clk_hw *hw) { struct clk_dmn *clk = to_dmnclk(hw); u32 cfg = clkc_readl(clk->regofs); + const char *name = clk_hw_get_name(hw); /* parent of io domain can only be pll3 */ - if (strcmp(hw->init->name, "io") == 0) + if (strcmp(name, "io") == 0) return 4; WARN_ON((cfg & (BIT(3) - 1)) > 4); @@ -312,9 +313,10 @@ static int dmn_clk_set_parent(struct clk_hw *hw, u8 parent) { struct clk_dmn *clk = to_dmnclk(hw); u32 cfg = clkc_readl(clk->regofs); + const char *name = clk_hw_get_name(hw); /* parent of io domain can only be pll3 */ - if (strcmp(hw->init->name, "io") == 0) + if (strcmp(name, "io") == 0) return -EINVAL; cfg &= ~(BIT(3) - 1); @@ -354,7 +356,8 @@ static long dmn_clk_round_rate(struct clk_hw *hw, unsigned long rate, { unsigned long fin; unsigned ratio, wait, hold; - unsigned bits = (strcmp(hw->init->name, "mem") == 0) ? 3 : 4; + const char *name = clk_hw_get_name(hw); + unsigned bits = (strcmp(name, "mem") == 0) ? 3 : 4; fin = *parent_rate; ratio = fin / rate; @@ -376,7 +379,8 @@ static int dmn_clk_set_rate(struct clk_hw *hw, unsigned long rate, struct clk_dmn *clk = to_dmnclk(hw); unsigned long fin; unsigned ratio, wait, hold, reg; - unsigned bits = (strcmp(hw->init->name, "mem") == 0) ? 3 : 4; + const char *name = clk_hw_get_name(hw); + unsigned bits = (strcmp(name, "mem") == 0) ? 3 : 4; fin = parent_rate; ratio = fin / rate; -- 2.20.1