From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 740E532F749 for ; Mon, 18 May 2026 15:53:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779119617; cv=none; b=kdJ2OYA/2Dw0aDTsZ2YJjAnnJStFawr8Fvxshgns3gxx9qUxWJbetKfjSr0rBBvBDGX/PZ08Fl01zgwNNOseMPOR8XU+ZsW0ZNwFSBz4AWs+bC/8JGemyqwbcg/2pRp/TQY8RQ3FKHDjCqfE6kOAOJmIF7DcO9Fs4bDMtOi1aWM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779119617; c=relaxed/simple; bh=S6SVBqmcAvHY5nTiiDj99x5B0CqWbX8RSys9dvTwzVk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oahlqPEJpcKWrSfbV7bs5YAfSGFL0Wa2EsMGrISq2t1ErKqXzhAHo7CSK1L3kh8R8XaFRVKaVZTES6oN3zUxM1ikOD382ZbvhyEyEsJsSCqhGu/2LbY7gBuRZhCWppohTmOh3LKtXRyTDwb/rvezSEG081fUVUty/lo289rXPJE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=gEIL5JDj; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=tgzJw+j2; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gEIL5JDj"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="tgzJw+j2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779119609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wZCyUkEWRjyv2fKKDGGvW1Vl+jU51oCsDzDIRpAen0g=; b=gEIL5JDjDLezKWWHvXVMOTwyG3cMwTt7md6pTQ3mKuqmJL15glXW8CTliw3R65uOwHHtQm Yic1IuoWNdukIKy278tj/01LmcueP7feNKgH3/mdOHUxPneWdeM0U0h69a/sotYmJKJj3c z10B0lUP410QNxTkAjw44UF8CIxeE70= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-458-JlPkYqw1MNmlyqDR3Lwiog-1; Mon, 18 May 2026 11:53:28 -0400 X-MC-Unique: JlPkYqw1MNmlyqDR3Lwiog-1 X-Mimecast-MFC-AGG-ID: JlPkYqw1MNmlyqDR3Lwiog_1779119608 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-8b49260e3d5so43211466d6.2 for ; Mon, 18 May 2026 08:53:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1779119608; x=1779724408; darn=vger.kernel.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=wZCyUkEWRjyv2fKKDGGvW1Vl+jU51oCsDzDIRpAen0g=; b=tgzJw+j2vhZNqmMa3hG500Ea43o4/yQMZlOHrwfG6AEthEPZRsLiP8xp3s2EbpM7O2 1L2jqMfsC7LeCWMfE0gekaQdqnBPjdzx0pCZtYFOM9qvdbbRPPB8qFe1WHZuY66VZV2y UlcfuuDAPsj0+84QLv2U3m5wcm8XhMFmGnf2nLVlO1msMhFXuI1c2F0rJR8JSIRz+UCp iJ+lkW41M+nwLAcw89pzD7x0RZkWH5nAhduKDCwmSOdQasxNlbblmaoFdXp2e1wWWXRw F3jeP2RZC8WRoWHBUIXxmzdQNvmoNgGboNvlVnXALoKRUfd0ghyzJt040F/czwDKCgc6 z0ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779119608; x=1779724408; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=wZCyUkEWRjyv2fKKDGGvW1Vl+jU51oCsDzDIRpAen0g=; b=MInpmTrQdkG0kiOUrbD8YevZsiGGpQHOSLpaFIKiUxTVN0LI3U0eRPTHY8ymDqGac/ lyM3skvHJ7Joa85dRAIiX7t+6mg3nZOZjNxVfyNu+mTAPbC7NTs5PnYT6aQgIN+sLCpg 4zMO9Jl1e/5VH7ly+NvxG0+hEphQ4YSGMKNarpZYkiobGDlORcnU7voZYiT67L1QGiE0 WZhH6TQSw7OE2gwK15WLn8WOOJXS/r9wqA9MVtWAVPP7RBOBnzVIPARzZ/JiP6I691hz di0O+LvfArbLagU0iL1f1HvRvIn/mpyIlWfFBeSNEDM04tBC40+4bkOgU8dsCKzjQkvH BHjQ== X-Forwarded-Encrypted: i=1; AFNElJ923g4tXOfSwogUvAL66Y92vMPHUvdkcudhB5nibO4sDwGksmHry6p22rqUMm5k5P5TMBRUntBkQJCm+bw=@vger.kernel.org X-Gm-Message-State: AOJu0Yz96Lh8irgSdyQKH8xrwLB6LXi6MicacqO8/VE4DLpl2/K6EfI1 CQs8X+jflsiZr1CU5zUiltFdTTWYrcK7y2DIgzH7S0oQMh0q3WY4EZFlEBx8uQ5dlt5GS7dGUSO f+vtMgSQyTTjwWH0jkH/10ENRJft7sgEN3PAhM8n6WKUqcSPDxStecrJsLr3LVOpIvA== X-Gm-Gg: Acq92OEFcI2HdxzxVoIzLR6DDRrbl/YFe1xj7EgyRc67ONqGlLHrDuoY1xDGVEjFeYn iZ4OgO/HKIIshGV1+POvK1xI3v/i82f9xa4t3yQm+qCDPW0Y6sxC615PLvlOy6F/lbBhwlxR2q+ oGgMDU2l//k/XjVduEgSrIYR89LH9gre6tynHX6Od5jFDeiwtqEuo99lcwlWUGx57iuMaavluTH UGUUzySgYJg/KyQbr9AmBRMPu31rY+oH5rzGYw14iGrxoyRfYbqtvGN+fCgj37OoPXZnFdqDA7Z Xxib2obT24iZnbYYCyXzzO524ieCTcXKrV7P9jsnx17R7Fb2RLSUHWecU7/+aj9fjvCXYhbaeK+ HXEh87zOcc9Ic193zFk7o85xt625jwBSLhwN7JQIJX8UXOHMqG5nlZEo0 X-Received: by 2002:a05:620a:4006:b0:8c9:fb69:e708 with SMTP id af79cd13be357-911cc6aeac9mr2295179685a.25.1779119607754; Mon, 18 May 2026 08:53:27 -0700 (PDT) X-Received: by 2002:a05:620a:4006:b0:8c9:fb69:e708 with SMTP id af79cd13be357-911cc6aeac9mr2295176185a.25.1779119607260; Mon, 18 May 2026 08:53:27 -0700 (PDT) Received: from redhat.com (c-73-183-52-120.hsd1.pa.comcast.net. [73.183.52.120]) by smtp.gmail.com with ESMTPSA id af79cd13be357-910baf2236fsm1529569185a.20.2026.05.18.08.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2026 08:53:26 -0700 (PDT) Date: Mon, 18 May 2026 11:53:24 -0400 From: Brian Masney To: Junhui Liu Cc: Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, Troy Mitchell Subject: Re: [PATCH v5 1/6] clk: correct clk_div_mask() return value for width == 32 Message-ID: References: <20260514-dr1v90-cru-v5-0-34f3021aab51@pigmoral.tech> <20260514-dr1v90-cru-v5-1-34f3021aab51@pigmoral.tech> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260514-dr1v90-cru-v5-1-34f3021aab51@pigmoral.tech> User-Agent: Mutt/2.3.1 (2026-03-20) On Thu, May 14, 2026 at 05:27:17PM +0800, Junhui Liu wrote: > The macro clk_div_mask() currently wraps to zero when width is 32 due to > 1 << 32 being undefined behavior. This leads to incorrect mask generation > and prevents correct retrieval of register field values for 32-bit-wide > dividers. > > Although it is unlikely to exhaust all U32_MAX div, some clock IPs may rely > on a 32-bit val entry in their div_table to match a div, so providing a > full 32-bit mask is necessary. > > Fix this by using the standard GENMASK() macro. This safely resolves the > undefined behavior on both 32-bit and 64-bit architectures, while also > benefiting from the built-in compile-time type and bounds checking > provided by the GENMASK() macro. > > Cc: Troy Mitchell > Cc: Brian Masney > Signed-off-by: Junhui Liu Reviewed-by: Brian Masney