Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4462673rwb; Tue, 6 Sep 2022 07:54:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Yo3QqTs1AgiDPhGqbxPyBRqGFha5GCsWe9zTL7sojMuGAcIfBJXTEmgumThcsgO2rvEP0 X-Received: by 2002:a05:6402:1b0c:b0:44e:8ae1:8016 with SMTP id by12-20020a0564021b0c00b0044e8ae18016mr8227394edb.342.1662476074713; Tue, 06 Sep 2022 07:54:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662476074; cv=none; d=google.com; s=arc-20160816; b=Zr4BOShWyncJq1E9PzFwDoX6uSSaDo4Ufgrk8zhMZIWSOLQ3wnlMCXdjlQQedPKZDt QUdVF9jQ9wW3VNcKe9R9LHV68CwWY2NIoLSpvadbeOKjgJpBMEVxxAsEf1kZV3NfuUsp 23DROQTlemya5hC6/NB6MKdOcX4hYG1SnUAimS77+Pim74jcTRSR1NBO0DZoJqm05q0u Q6ifu5AhUo5m1taLA2+v+y3TbmkK5XghH4cMTvFbupQ6Hy6lWkbV/aHJf0hrib3NYHYA 02ca9Z0upE7fV0mCv216rhSv6Fecfhs+DYIJYJCpf5HTiVxxgkmbLsJAxEWjogbwsfUp M1QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fAB39JH9+BZO+LuvJtFl4AYP2lC4Ep8HyC23/npB8xc=; b=Cw8tiIPmc8TVGxFhnwidoOS71mN0NnfvMzaSNaA9k17bHDy1lN0QpMyGDWSg+Gyoj4 hZimfjQbk8teO+60qNSxj1248qSY9EuCszjv99RadoDBAeAYLQ68B8ASu03IVvEgFteX WfHgb8MmCyyjq/oC43OrWD996A9spEQTwuxFAR3GYdqGkz6Gkq/+zg5bxFoUjv7jXANO /hRGboMg7uWNRKfuAnM5Kh9Fz1fFfDQhcen8drahT93T6QHddGByL/w7bx3BfysjpniV qmDJsVBP4UVaO9IftmKxULCeZaCZysLLWOWJdUxjwpvRfLHXcBEwo8e6gH59Up8jL/kO KcAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Ts9Emv/8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n5-20020a509345000000b0044811f7cfa6si9985076eda.486.2022.09.06.07.53.47; Tue, 06 Sep 2022 07:54:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Ts9Emv/8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240732AbiIFNf5 (ORCPT + 99 others); Tue, 6 Sep 2022 09:35:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240625AbiIFNfP (ORCPT ); Tue, 6 Sep 2022 09:35:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20FE37820C; Tue, 6 Sep 2022 06:33:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A9489B8162F; Tue, 6 Sep 2022 13:33:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16281C433D6; Tue, 6 Sep 2022 13:33:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662471221; bh=HHBB9KyuFX+GW7Ogc+UaflVg9kT9RKJe53j3ymPYA2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ts9Emv/8JjuCWbkBHpies4LsMY96Bwi/39MuWm/A8KZIjSXFj05CPUCNf+Mc1f40W +ZntpQKDk3WZVCUwYzpvcou12iwFOCF8ovAnO3e5VvlIj0ASvY/Ki7/6Zfz9nACXbV dAcdIPmRcu7eqteXayOpEL6mi5pggHO1Fz+Nsnlc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Wahren , Florian Fainelli , Stephen Boyd , Sasha Levin Subject: [PATCH 5.10 38/80] clk: bcm: rpi: Fix error handling of raspberrypi_fw_get_rate Date: Tue, 6 Sep 2022 15:30:35 +0200 Message-Id: <20220906132818.585072990@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132816.936069583@linuxfoundation.org> References: <20220906132816.936069583@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 From: Stefan Wahren [ Upstream commit 35f73cca1cecda0c1f8bb7d8be4ce5cd2d46ae8c ] 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 Link: https://lore.kernel.org/r/20220625083643.4012-1-stefan.wahren@i2se.com Fixes: 4e85e535e6cc ("clk: bcm283x: add driver interfacing with Raspberry Pi's firmware") Acked-by: Florian Fainelli Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- 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 f89b9cfc43099..2c12bd5ac1388 100644 --- a/drivers/clk/bcm/clk-raspberrypi.c +++ b/drivers/clk/bcm/clk-raspberrypi.c @@ -139,7 +139,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; } -- 2.35.1