From patchwork Sat Jun 25 08:36:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 12895271 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E0B5CC43334 for ; Sat, 25 Jun 2022 08:38:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ciWI3URBDCbb+md5JRzSBp2kfKMZyZrE/JBuZI13Rjk=; b=1b3et0aWreODdc kbkEFjFQ489QHdgd43RXfGxeataoV/gqSYdTPOF8zw6ATw0kl3QOwXgwlHogQsKbu+gC5D6ZgsTxw 6du6MzwyUMAxzw3wIdh/f2FyykupEexkdkjpXlrl2h7wP43BHGnKOWacI5LFRivCbXUq2zOLElR9b onA1CkECZnFIYMTQzCIJ5aS3tnef9KMzvor29P1xODCy+FJGuyHuTrSHxwqZGPz/F79KVryLvMX1F SQp9P2+7423/qNTQc53lC8qLvmVTkzw+aONXDADecxfeaBRwxPsQxJJ6c5rLl4D3Kznt0m12ovD4F Q3GGpiEMJzXmW/MOIb6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o51IM-005AUT-0l; Sat, 25 Jun 2022 08:37:34 +0000 Received: from mout.kundenserver.de ([212.227.126.133]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o51IJ-005ATH-4m for linux-arm-kernel@lists.infradead.org; Sat, 25 Jun 2022 08:37:32 +0000 Received: from localhost.localdomain ([37.4.249.155]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M3DBd-1o6OCq1Hif-003aCA; Sat, 25 Jun 2022 10:37:21 +0200 From: Stefan Wahren To: Florian Fainelli , Michael Turquette , Stephen Boyd Cc: bcm-kernel-feedback-list@broadcom.com, Maxime Ripard , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Stefan Wahren Subject: [PATCH] clk: bcm: rpi: Fix error handling of raspberrypi_fw_get_rate Date: Sat, 25 Jun 2022 10:36:43 +0200 Message-Id: <20220625083643.4012-1-stefan.wahren@i2se.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:Vy6icAiczF0gw0MoXatbk2jXhrSuQ7VJMzuHmw0S6CNnF5C1W5Z Agav/V+gv8xK47eb0kYjJuh7ANFjFg6yE6t29NIk37gM7sgslw1fuMkH8rFWV0im+Mm8uvO TgA+Inxv9MxfR0oHG/XcD6p8mN0z6svksrTveZc+hgcHAqp83VguIR0UUMNfNihO4TLeAuk KNPAg8sHJlV51kcwjg7DA== X-UI-Out-Filterresults: notjunk:1;V03:K0:Stru1JlMmJ0=:gfTZrHPcEAVKnTCpULi1sm GK/p9GY678WyqGGjQF0Vf2EcsNrK4BHkLrfPveBN8jKBvGXrRrsaeNjmpPipvXvM4GN3qrP2Q ha9toybsFXWHVLvXGUSD99fDb29YWRmVDCooAqmsOkC+92w7/3xfyVC8SArdoflhtxX3Yx++m Og71tBBdIF9V7m1UCHv7LvZpawGtivezMkEFRA1KiOykjE0hy8NpsVb7LF6xgT3KU/Ou2f0zC Q8SULZ60Ss1iZFkZexnl5Rurkagijt/wDd7y3WqdVIfAnieZe1r9hVvj2RGdJDwi+hQBDPyby wlP7N24XiiSAb04TaMuIu/MxiRunE5JP+H2A9bzdB7jgwPRrJAJLzaaQF0ys6zEGSbWn1TmDh Tyn6gFZSwaTT3f5FQM01z2beXbjt9wOJHyIyl+VXNAWyUAbHyyq2WMRTP0HnXan3ol3ffTEkw q09DDoeZEZ7BGWPPZudCwpYwFjRbRPEUjh7pi+SafTo8VUuAbycz1FXjgn3s9yBInQ4nxB+5C I3xg21uX366vbd+CEQKjvkOOpTBV8kTBpdebRlbS4+9h2BQZF02jjnhcThGH/Cq48+J10X9Y9 V0A/kMEaXwoqfIuqxnMO+cCvOJILEhH6q4bPPhIBJ93caTPCFYDidtTlasDmf6XQjFj44AgnD AfM/m1iMXqipBm4v0U9zqXUNedql+pVHbj8A9doeQm6Ik9hNT2pJbx11Sdj6STd4EXGApJJ5T RaBjKU3FqR3pqxJ5zFtjoVdvP3fSbwKY5KzWwh1GlaEadXfzJdLiHIxvLmc= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220625_013731_519704_3B491645 X-CRM114-Status: GOOD ( 12.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The function raspberrypi_fw_get_rate (e.g. used for the recalc_rate hook) can fail to get the clock rate from the firmware. In this case we cannot return a signed error value, which would be casted to unsigned long. Fix this by returning 0 instead. Signed-off-by: Stefan Wahren Acked-by: Florian Fainelli --- drivers/clk/bcm/clk-raspberrypi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspberrypi.c index 73518009a0f2..39d63c983d62 100644 --- a/drivers/clk/bcm/clk-raspberrypi.c +++ b/drivers/clk/bcm/clk-raspberrypi.c @@ -203,7 +203,7 @@ static unsigned long raspberrypi_fw_get_rate(struct clk_hw *hw, ret = raspberrypi_clock_property(rpi->firmware, data, RPI_FIRMWARE_GET_CLOCK_RATE, &val); if (ret) - return ret; + return 0; return val; }