From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C2CFC433B4 for ; Wed, 21 Apr 2021 13:50:55 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5E5AF6144B for ; Wed, 21 Apr 2021 13:50:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E5AF6144B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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=3z3U5m4+S606FaV+60io9H20d5hy+Px37RedxXG5nG0=; b=Z+Q8bw6UfX7YTZ2HxACJ9acBD7 4ILlV9YtvylO0UToWShPgHgOMcyGsTDX4XtjyKKbpO8vnW3DdrplGX+yEOZzNmm0ibGl9mIU72+KQ ora+s+G8vn23q8ZJKZeTV7X6wxBUvnaUflbqAEkMduLtzwQzAK1K2B1evDKPWM6weD3k0Aph4DcOH N6Gj7SFXv7v22O6AjftykWi5NgiU5v5uNZKytCUXoqshmrvCvBvtnRfxGH66/LQhtOKz3FtjAtCX8 JXUBFV7Ie6WTcY1lh7up5yHbUqpNMBu+/qdFDl1ilsvOmdo1UwpWoGEeX7vxUyqpehaTikOWO7nxk 0PCdtCyg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lZDDv-00EV0z-Ul; Wed, 21 Apr 2021 13:49:00 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZDDq-00EV0K-Sg for linux-arm-kernel@desiato.infradead.org; Wed, 21 Apr 2021 13:48:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=A/+yo4cQdAoeEdLd/VmJGrrWbO02yTdCTXKsmXFD3bI=; b=pXdVSQJRejYVC6//W0gwIyLuNR 7Vu+hK91xVl+BaGWNoYOT7LR4iR7U3znYfLhaUUwBdfj56svFz4iufpLMoHuh2OekxIywGl/ctsKz uMCVmkpcnTn2w7zrq2u6IJEdLqdgigNfO0mhNtL1GhCUSZyGN6SVJTQGQfL0J+jBaVLJqzIwEO+ef aSQOykcwmQSI0vLrYG7kgPOHKBx30J8d9YGJDhecMs9BS3yUl10nDjXK04ZOL/TSUlLE1Q4fKMj5+ yxVLohgvgnRVcp6JemxQZFqF00+RZ7voakuqtIL1Ih0MCDDh35tkOo9NR+XqYlraNd6yzI+/xKISD vzvR8KUQ==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZDDo-00CvgL-B8 for linux-arm-kernel@lists.infradead.org; Wed, 21 Apr 2021 13:48:53 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6582260C3E; Wed, 21 Apr 2021 13:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619012931; bh=GO+ss1xX6Lr1YX4hNiDs80lMaAeRx4c1oZ6yYsxMykQ=; h=From:To:Cc:Subject:Date:From; b=VrG0KnI6VBOhtLUFd2RazGeMmsYt/daXvXTmZ48fKOGiBpLc9UDe7tiwvERYGRlsr 3+JTtEavmFpxvPm3gDmSTSWXU6o0OnNUXGuL8h92WrArf0xSN1OBIAhDfg6W4yT2cW pU7oikukC4k6PU52frLsP8agFnx3/QBTrT0CvtFoCzm61TXVIST3CIrXfgSwDKItO8 YwPvUOJtvpGWuPZxOJyNaLne5TuJTpietQOD3wOZ+0jsa+i0nVr0SBtLxzlL2neqDh eIW4IKw6uEa7quqxXb9DMzWPlfKKKKjPe2HJyWvkkR8FHm6dq0BDHLI0Mp1ikFc2BA IBPgBmYntdr7A== From: Arnd Bergmann To: Michael Turquette , Stephen Boyd , Michal Simek , Punit Agrawal Cc: Arnd Bergmann , Rajan Vaja , Greg Kroah-Hartman , Jolly Shah , Quanyang Wang , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] clk: zynqmp: fix compile testing without ZYNQMP_FIRMWARE Date: Wed, 21 Apr 2021 15:48:36 +0200 Message-Id: <20210421134844.3297838-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210421_064852_478928_8856757D X-CRM114-Status: GOOD ( 13.70 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Arnd Bergmann When the firmware code is disabled, the incomplete error handling in the clk driver causes compile-time warnings: drivers/clk/zynqmp/pll.c: In function 'zynqmp_pll_recalc_rate': drivers/clk/zynqmp/pll.c:147:29: error: 'fbdiv' is used uninitialized [-Werror=uninitialized] 147 | rate = parent_rate * fbdiv; | ~~~~~~~~~~~~^~~~~~~ In function 'zynqmp_pll_get_mode', inlined from 'zynqmp_pll_recalc_rate' at drivers/clk/zynqmp/pll.c:148:6: drivers/clk/zynqmp/pll.c:61:27: error: 'ret_payload' is used uninitialized [-Werror=uninitialized] 61 | return ret_payload[1]; | ~~~~~~~~~~~^~~ drivers/clk/zynqmp/pll.c: In function 'zynqmp_pll_recalc_rate': drivers/clk/zynqmp/pll.c:53:13: note: 'ret_payload' declared here 53 | u32 ret_payload[PAYLOAD_ARG_CNT]; | ^~~~~~~~~~~ drivers/clk/zynqmp/clk-mux-zynqmp.c: In function 'zynqmp_clk_mux_get_parent': drivers/clk/zynqmp/clk-mux-zynqmp.c:57:16: error: 'val' is used uninitialized [-Werror=uninitialized] 57 | return val; | ^~~ As it was apparently intentional to support this for compile testing purposes, change the code to have just enough error handling for the compiler to not notice the remaining bugs. Fixes: 21f237534661 ("clk: zynqmp: Drop dependency on ARCH_ZYNQMP") Signed-off-by: Arnd Bergmann --- drivers/clk/zynqmp/clk-mux-zynqmp.c | 4 +++- drivers/clk/zynqmp/pll.c | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/clk/zynqmp/clk-mux-zynqmp.c b/drivers/clk/zynqmp/clk-mux-zynqmp.c index 06194149be83..2afded3c7c11 100644 --- a/drivers/clk/zynqmp/clk-mux-zynqmp.c +++ b/drivers/clk/zynqmp/clk-mux-zynqmp.c @@ -50,9 +50,11 @@ static u8 zynqmp_clk_mux_get_parent(struct clk_hw *hw) ret = zynqmp_pm_clock_getparent(clk_id, &val); - if (ret) + if (ret) { pr_warn_once("%s() getparent failed for clock: %s, ret = %d\n", __func__, clk_name, ret); + return ret; + } return val; } diff --git a/drivers/clk/zynqmp/pll.c b/drivers/clk/zynqmp/pll.c index abe6afbf3407..67d2a2d260c1 100644 --- a/drivers/clk/zynqmp/pll.c +++ b/drivers/clk/zynqmp/pll.c @@ -54,9 +54,11 @@ static inline enum pll_mode zynqmp_pll_get_mode(struct clk_hw *hw) int ret; ret = zynqmp_pm_get_pll_frac_mode(clk_id, ret_payload); - if (ret) + if (ret) { pr_warn_once("%s() PLL get frac mode failed for %s, ret = %d\n", __func__, clk_name, ret); + return ret; + } return ret_payload[1]; } @@ -140,9 +142,11 @@ static unsigned long zynqmp_pll_recalc_rate(struct clk_hw *hw, int ret; ret = zynqmp_pm_clock_getdivider(clk_id, &fbdiv); - if (ret) + if (ret) { pr_warn_once("%s() get divider failed for %s, ret = %d\n", __func__, clk_name, ret); + return -1ul; + } rate = parent_rate * fbdiv; if (zynqmp_pll_get_mode(hw) == PLL_MODE_FRAC) { -- 2.29.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel