From patchwork Thu Jan 2 02:32:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pei Xiao X-Patchwork-Id: 13924291 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 04DC4E7718B for ; Thu, 2 Jan 2025 02:33:15 +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:References:In-Reply-To: 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: List-Owner; bh=wfa+lOjH9eozq13oNmzEDfyFYxt/EaX+UdOKGcXvpAM=; b=wvVW6I0cQapZJ6 oO1ZCrfvnxdzwMs/nMM5Fo95I5qK+rHLXHXVE8S73hIoty0K0GLm21qLlPIZmC2Vf0Q6brIl2VSVL 4y/Z7f0XvE3KE5gv0N+zycPyMn9fxHl/F1gg8WMqmIQzWdaMA5BLa/SMv/wFvZfXPP9/oXHX0XkR1 G7M2ftDtLdl1XBtWCtJCMu33gKab09Us+5oSy5yX5zAUjbklDnA7O9p7LGbYLgIpPf+ek9gvgz+EL PtLffdUi7qjwQo36vWmdQRtBUudVG70oo7d6mDbihs9OxwbcO53alMedsld4oxlDr0T6frOu0IcbG MnvGAw8yKX2vwJgWBysQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tTB1P-00000009bv1-2CCN; Thu, 02 Jan 2025 02:33:15 +0000 Received: from mailgw.kylinos.cn ([124.126.103.232]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tTB1M-00000009buh-23bR for linux-phy@lists.infradead.org; Thu, 02 Jan 2025 02:33:14 +0000 X-UUID: e5f806d2c8b111efa216b1d71e6e1362-20250102 X-CTIC-Tags: HR_CC_COUNT, HR_CC_DOMAIN_COUNT, HR_CC_NO_NAME, HR_CTE_8B, HR_CTT_TXT HR_DATE_H, HR_DATE_WKD, HR_DATE_ZONE, HR_FROM_DIGIT_LEN, HR_FROM_NAME HR_SJ_LANG, HR_SJ_LEN, HR_SJ_LETTER, HR_SJ_NOR_SYM, HR_SJ_PHRASE HR_SJ_PHRASE_LEN, HR_SJ_WS, HR_TO_AS_FROM, HR_TO_COUNT, HR_TO_DOMAIN_COUNT HR_TO_NO_NAME, IP_TRUSTED, SRC_TRUSTED, DN_TRUSTED, SA_TRUSTED SA_EXISTED, SN_TRUSTED, SN_EXISTED, SPF_NOPASS, DKIM_NOPASS DMARC_NOPASS, CIE_BAD, CIE_GOOD_SPF, GTI_FG_BS, GTI_RG_INFO GTI_C_BU, AMN_T1, AMN_GOOD, AMN_C_TI, AMN_C_BU X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.41,REQID:d574fe76-9993-4111-977e-fec511b003a1,IP:0,U RL:0,TC:0,Content:35,EDM:0,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:30 X-CID-INFO: VERSION:1.1.41,REQID:d574fe76-9993-4111-977e-fec511b003a1,IP:0,URL :0,TC:0,Content:35,EDM:0,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:30 X-CID-META: VersionHash:6dc6a47,CLOUDID:229384d6987eb6bf5ee8c9b744993455,BulkI D:241230101136WWCDXQWK,BulkQuantity:1,Recheck:0,SF:17|19|66|78|81|82|102,T C:nil,Content:4|50,EDM:-3,IP:nil,URL:0,File:nil,RT:nil,Bulk:40,QS:nil,BEC: nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD X-UUID: e5f806d2c8b111efa216b1d71e6e1362-20250102 X-User: xiaopei01@kylinos.cn Received: from localhost.localdomain [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 2055933202; Thu, 02 Jan 2025 10:33:06 +0800 From: Pei Xiao To: xiaopei01@kylinos.cn Cc: aford173@gmail.com, aford@beaconembedded.com, arnd@arndb.de, dominique.martinet@atmark-techno.com, frieder.schrempf@kontron.de, geert@linux-m68k.org, kishon@kernel.org, l.stach@pengutronix.de, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, m.felsch@pengutronix.de, sandor.yu@nxp.com, u.kleine-koenig@baylibre.com, vkoul@kernel.org Subject: [PATCH] phy: freescale: fsl-samsung-hdmi: fix build error in fsl_samsung_hdmi_phy_configure_pll_lock_det Date: Thu, 2 Jan 2025 10:32:56 +0800 Message-Id: <1a684565d9765e3db49eb504a9cb6bc72a5d4fd1.1735785110.git.xiaopei01@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <3bcfd31d-0ddb-46a7-9ed8-5b41047d8e69@kylinos.cn> References: <3bcfd31d-0ddb-46a7-9ed8-5b41047d8e69@kylinos.cn> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250101_183312_827772_C4243FC4 X-CRM114-Status: UNSURE ( 9.19 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org FIELD_PREP() checks that a value fits into the available bitfield, but the index div equals to 4,is out of range. which gcc correctly complains about: In function ‘fsl_samsung_hdmi_phy_configure_pll_lock_det’, inlined from ‘fsl_samsung_hdmi_phy_configure’ at drivers/phy/freescale/phy-fsl-samsung-hdmi.c :470:2: ././include/linux/compiler_types.h:542:38: error: call to ‘__compiletime_assert_538’ declared with attribute error: FIELD_PREP: value too large for the field 542 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^ ././include/linux/compiler_types.h:523:4: note: in definition of macro ‘__compiletime_assert’ 523 | prefix ## suffix(); | ^~~~~~ ././include/linux/compiler_types.h:542:2: note: in expansion of macro ‘_compiletime_assert’ 542 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) REG12_CK_DIV_MASK only two bit, add logical AND to limit range 0~3, so build error will fix. Fixes: d567679f2b6a ("phy: freescale: fsl-samsung-hdmi: Clean up fld_tg_code calculation") Signed-off-by: Pei Xiao --- V2: change to use logical AND --- drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c index 5eac70a1e858..7b70ea7b1599 100644 --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c @@ -341,7 +341,8 @@ fsl_samsung_hdmi_phy_configure_pll_lock_det(struct fsl_samsung_hdmi_phy *phy, break; } - writeb(FIELD_PREP(REG12_CK_DIV_MASK, div), phy->regs + PHY_REG(12)); + /*REG12_CK_DIV_MASK only two bit, logical AND to limit range */ + writeb(FIELD_PREP(REG12_CK_DIV_MASK, div & 0x03), phy->regs + PHY_REG(12)); /* * Calculation for the frequency lock detector target code (fld_tg_code)