From patchwork Thu Jun 29 06:01:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 9816011 X-Patchwork-Delegate: sboyd@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 15FCB60365 for ; Thu, 29 Jun 2017 06:01:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03914285A3 for ; Thu, 29 Jun 2017 06:01:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC2A1285EF; Thu, 29 Jun 2017 06:01:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30E2A285A3 for ; Thu, 29 Jun 2017 06:01:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751666AbdF2GBV (ORCPT ); Thu, 29 Jun 2017 02:01:21 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:35077 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751631AbdF2GBU (ORCPT ); Thu, 29 Jun 2017 02:01:20 -0400 Received: by mail-pg0-f66.google.com with SMTP id f127so10667075pgc.2 for ; Wed, 28 Jun 2017 23:01:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=7TDys/YZNwtzHjojGphA5gMOlnkgbffnhCQ6ZExYs5U=; b=jouE1hMAk6wnzcXEitMhjX1Dey8krejsMKLtddUXR5OA9ZlthQl5A9l35eGowvT94o IvsqwyO7heZ7G/AZvHv/DVxwlKsb1Fc0bVUgFl4JYlyPfeN0VhUZLsmUUERHOFlCkDhb SOg3qWap1JkAqxboVXK6aJeHSID/uFCRIleQtFASF+M7HUySdF4nvABf0v+kiJapEf+A A42/BzCtpEa+mTofVeuIF3+IjUv2Dufib+OKw5oXNL2MtNs+OGCwiIYr9wflVS4GUP/q r5FVH18UzosHd1OoeR+4Tw8VZDiZ+/dwyBZ8ocq1l7JNIOoyhzPUJ0BUra7Y6DQ/pPKc aciQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=7TDys/YZNwtzHjojGphA5gMOlnkgbffnhCQ6ZExYs5U=; b=dol6/1EkOPys0BAUEjMbhTw4sA3pEuaU7nwlB3b4jsewVUhz1FuWNcUBM2nnAJ2hKv LPHeSYi1CSoQTE/qwoU8hv1nStyGObC4r5JmLjDotcarYc/hp2bYVFxdQjowWd3DKQPs 0FCDb49UFsezr177+Nnvu3ymBXyG86Gk5HPLX4+P4uhklo/R34E0ua1EP+pee2GqmOGM IUnVmdpKYF6T6vEyEgmC4ENtGSX6U0yXOz7eO2ZoIzsKsB5RBMEulYQ4/jvWDFe4/LCg Y/zpO/eAYVwlfhvyLrr3WZe0PLBpC7+gWGD+PljufLgenYTdmnE/IsAx5FC9VBddq1Pf 9w3A== X-Gm-Message-State: AKS2vOzOTXD/p0SUx88n+u8bSOJBs8yeYW0dpsOh+XWaszfk8x6kM0T/ wGZiTCf17lVuiA== X-Received: by 10.99.174.67 with SMTP id e3mr13779523pgp.75.1498716074990; Wed, 28 Jun 2017 23:01:14 -0700 (PDT) Received: from aurora.jms.id.au ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id g10sm5838584pgr.18.2017.06.28.23.01.11 (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 28 Jun 2017 23:01:14 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Thu, 29 Jun 2017 15:31:08 +0930 From: Joel Stanley To: Michael Turquette , Stephen Boyd Cc: linux-clk@vger.kernel.org, Linus Walleij Subject: [PATCH] clk: gemini: Read status before using the value Date: Thu, 29 Jun 2017 15:31:07 +0930 Message-Id: <20170629060107.12548-1-joel@jms.id.au> X-Mailer: git-send-email 2.13.2 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The probe does a shift and mask of val without having read it from the hardware. Fixes: 846423f96721 ("clk: Add Gemini SoC clock controller") Signed-off-by: Joel Stanley Reviewed-by: Linus Walleij --- Compile tested only as I don't have access to the hardware. I noticed the bug while reading the driver. drivers/clk/clk-gemini.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/clk-gemini.c b/drivers/clk/clk-gemini.c index b82db96ce0c7..c391a49aaaff 100644 --- a/drivers/clk/clk-gemini.c +++ b/drivers/clk/clk-gemini.c @@ -306,6 +306,7 @@ static int gemini_clk_probe(struct platform_device *pdev) gemini_clk_data->hws[GEMINI_CLK_RTC] = hw; /* CPU clock derived as a fixed ratio from the AHB clock */ + regmap_read(map, GEMINI_GLOBAL_STATUS, &val); val >>= CPU_AHB_RATIO_SHIFT; val &= CPU_AHB_RATIO_MASK; hw = clk_hw_register_fixed_factor(NULL, "cpu", "ahb", 0,