From patchwork Fri Aug 26 10:31:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Masson X-Patchwork-Id: 1670727 X-Patchwork-Delegate: seanga2@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=AEBhRuZo; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MDfbP2QQfz1yhX for ; Fri, 26 Aug 2022 22:41:37 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B08B684912; Fri, 26 Aug 2022 14:41:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="AEBhRuZo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A28F4845FE; Fri, 26 Aug 2022 12:35:53 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 77476848A2 for ; Fri, 26 Aug 2022 12:35:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jmasson@baylibre.com Received: by mail-wr1-x42a.google.com with SMTP id h5so1294810wru.7 for ; Fri, 26 Aug 2022 03:35:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc; bh=AgA96p2sDX6AHyBgJVRA5wyE1W5RwZR3ELh8uth1DDE=; b=AEBhRuZoKIRk6fHmm5pZVtPIZ61rJe6HcEwWxuFfwvZVOppGZRDosjcT/Z5nEgei89 qjkmGpNNLYJ99bBsCx+GATvSgNSjRex2pB1uVdhPds9OayZuIUFV2exE5U7lMncekUI4 Fp2PY1zVYJPOpKEs1QgIcyLzNL02NYsCxGeJUEOVMxQ+OCKQHNAXuEFuOU00dlKalQ+T GBL7HFQPgnCzwjhoR+i/wLmenUVoASMzmxwt0e+GBPkeVdB54EA1tI7gb+Y8ZsvVfVpf giqKd8W3R5+dHAbx6rMwz/y5atyeMZNdpL9xMR7pwFKg5pkt17MHrUJx8zCuyFhOvSQf sYgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc; bh=AgA96p2sDX6AHyBgJVRA5wyE1W5RwZR3ELh8uth1DDE=; b=DbwMqHDDuWHotdlemvgdVjnQV6gR00aJKqG8D16VWYOIJ8KXfSJIbPjYUoVNqXZjMb kLteuFsTs+8v2PHqMbOFaWAVIJycO1VEQ8Qpekg3shmw0xPLJPwShgSYT2DpThkYbxnR 1MSLN+0eGvGeYzhG6l3sbA3OvA2PYXMhRFgu328vAovzRB9YyzpefzKxjK5in55qxk4S pfekQbzLhJTY21Nz4KWWRQ1PPg7e69FA24ZBvsByIHRemAtdbho9dLLUzyAgqSIi4Jyu oGyVs8UURge6w8vTcwfP4kjCRltpXyR1vxAoOSataopXWooLyUhlEkrMY04HMfXJBMIU hcJA== X-Gm-Message-State: ACgBeo3hteq8iMz+i7EyxO+zdeKiAE+Kr26nw8DOw5RrrvdDUNzKO7cM TZz89+HugJ62540BPJ33sR3MYvDXHDPcMA== X-Google-Smtp-Source: AA6agR5h0pLOskjUWZbWQiX0vFdbEIeg7AC3KGRj8vTAjIvvNZ+ee6GpYp25EDMpxvI+/a44K17GMQ== X-Received: by 2002:a5d:6d8f:0:b0:225:6285:47fb with SMTP id l15-20020a5d6d8f000000b00225628547fbmr4696776wrs.211.1661510150560; Fri, 26 Aug 2022 03:35:50 -0700 (PDT) Received: from localhost (lfbn-tou-1-1369-76.w90-89.abo.wanadoo.fr. [90.89.178.76]) by smtp.gmail.com with ESMTPSA id t63-20020a1c4642000000b003a673055e68sm9129971wma.0.2022.08.26.03.35.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Aug 2022 03:35:49 -0700 (PDT) From: Julien Masson To: u-boot@lists.denx.de Cc: Sean Anderson , Lukasz Majewski Subject: [RFC PATCH] clk: fix clk_get_rate() always return ulong Date: Fri, 26 Aug 2022 12:31:15 +0200 Message-ID: <87a67rwav0.fsf@baylibre.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 26 Aug 2022 14:41:06 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean According to clk_ops struct definition, the callback `get_rate()` return current clock rate value as ulong. `clk_get_rate()` should handle the clock rate returned as ulong also. Otherwise we may have invalid/truncated clock rate value returned by `clk_get_rate()`. `log_ret` has also been removed since it use an `int` in the macro definition. Signed-off-by: Julien Masson --- drivers/clk/clk-uclass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index b89c77bf79..446f7c49b8 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -469,7 +469,7 @@ void clk_free(struct clk *clk) ulong clk_get_rate(struct clk *clk) { const struct clk_ops *ops; - int ret; + ulong ret; debug("%s(clk=%p)\n", __func__, clk); if (!clk_valid(clk)) @@ -481,7 +481,7 @@ ulong clk_get_rate(struct clk *clk) ret = ops->get_rate(clk); if (ret) - return log_ret(ret); + return ret; return 0; }