Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2545319lqp; Mon, 25 Mar 2024 02:01:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUGWtNAxSGaSBJFI33aT5HiVFAPpEFVzApt8It2KURivCLd8+BJMNJKHiuykoMnRdR6t6opv6Qeyj/P8x7/1Sr5l4t2eoodE8Kbd1qI6w== X-Google-Smtp-Source: AGHT+IHQt5r3QVaVc3dukxBsIR02Zry1hwpBpk8lDSI/jAIsAPOEZGRlL603OWhl0S8Q4GJNwz4B X-Received: by 2002:a92:d587:0:b0:368:7fdc:db68 with SMTP id a7-20020a92d587000000b003687fdcdb68mr4928176iln.30.1711357288120; Mon, 25 Mar 2024 02:01:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711357288; cv=pass; d=google.com; s=arc-20160816; b=lgfWVqxY+mtIreKJCMgrs1olDAnuyeAAy93/3WY/YK/EfjRrmSXRP8tebtHHfOM7JJ 3bFnaOtC49kdHy8+3KMC8GP5izbZsBjJjT4EeQ/+HekH/42w4AnN/tXaUyrvngmMzlDe 5CMlXFJ1L8MYtZlzcc0o7fgAqfC2nhhgjyhWcemYqOrizB+acBI6bIILTlnFcCJ8ftr9 73qMsacdRjMBaYbu7cs0g1OpFIkDUEOl8cHQ6qsjB5ku7y54hvueh9p0HGEe/ZF1tNUB 6Y9Gege3gkvVCFCrHotQOvxYsVdIDY+dwtupy5mZOwTYhQ87FFq63klVq6puBk6VplH/ ES5A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=nlffNDWpq+AdBbxhj8NQqz91dSZLs3jNtt94hkBCvlM=; fh=n3IfhNKiDIvqGGLL5fIgO9PW4+Jypx3PwOIiAfpxfY8=; b=c/5GZJ7boVm5r1lXcjbkE6TALl6bZ5RLHcdiZpBhdf0GovXrdKUs6AcecsJgPbq7c6 FOj+wSTvhnmCRQTvkdwjawcrEnN85+i5v9W+cUQi6kA6fe/NHDpHzeSEu5/sj1/420Ae REnQqsMFNqxlSAiKUXC1figcTHY2YWXocQiSeItzq7ecMs6bO6ajpUnHYXU0/K092Fte 7mBcyWnKeGHyDs/8R5/wYVmRDxmKFPZDV7pXb1l/juqBGY2HZMBawb3YLFdDkDyqNCuD +C/otQNMq5P4nv4rPHPK4TjashF236SKJ3bWenmh3V7k24AzJUiK8s2eBMIgs8Jpupwi NRgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=orqM0RQ0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115454-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115454-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id g16-20020a632010000000b005dc528d603bsi6654926pgg.675.2024.03.25.02.01.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 02:01:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115454-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=orqM0RQ0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115454-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115454-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B24EA29BAEE for ; Mon, 25 Mar 2024 09:00:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A60062062E7; Mon, 25 Mar 2024 02:39:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="orqM0RQ0" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2C68A1E587C; Sun, 24 Mar 2024 22:53:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320834; cv=none; b=oq1qP7kHNvNrmxuyc2aoHF2GrBvdEXwQ4YK6dlME3Ep05blqMkx2KYmhHlFHlfCTUN1EUHdJ5fH3ZvVyNe7jun0bC6wxY0+KkCMKQitomLdrziSBShnE9VwDBxV84UV9UbsWkANCf0WR4B6GjsO3aWmcEvMeuw1+H91bgSbbdaw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320834; c=relaxed/simple; bh=qgWoNH854Qu3UszLlD0IS5mUljLWw9/aZEUoPzuQfUA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jpYP/qxKw4ZSPxKcnXNUc0zOA6H1GPVxj+3GBYluqplEuU315Fq4QUiCsrFOdfYdRnZ3nU2PBoEOiLHZRN5lV5VH0XZA5vCAVInw9ifPAZeRkmoGqf+wzKsoCIdey3LacIdzAlFx7pyBaklxMjPUCeYPyOcHxVr+jQKKmfoOrm4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=orqM0RQ0; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 386C4C433A6; Sun, 24 Mar 2024 22:53:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320833; bh=qgWoNH854Qu3UszLlD0IS5mUljLWw9/aZEUoPzuQfUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=orqM0RQ0MIbu+9hWp/PTOIlq2C0aWr0tecQ+I/I6st74AszDtA4Nipz96d/C4NdEq pqaCTbzttctLrzy6orEoPFqhiWTmxK+QGgrQjAhv5s2pws23H2dWKYuMaPYJkLesuN ueUOo9A43aR6QUwaXAgMXhCNtHUJjuXaOEMiGVRZ4Gi79z++4kiVGuqcHwn6E2rezE WQQCt/670yNmTuo6z9lPY0GcxjThdKB8L9fDHJWjl2ymfu7brCMq83tjy5GNuApPLo YnIrapHeCVZ9pI4OlWRkhg0G4sx0PqhTYUDPKO/5jhB3OR+VGzs5ptTPdjPtMtZA8X LvA4d5UpzBUZg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Harry Wentland , Simon Ser , Melissa Wen , Melissa Wen , Sasha Levin Subject: [PATCH 6.7 398/713] drm: Don't treat 0 as -1 in drm_fixp2int_ceil Date: Sun, 24 Mar 2024 18:42:04 -0400 Message-ID: <20240324224720.1345309-399-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324224720.1345309-1-sashal@kernel.org> References: <20240324224720.1345309-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Harry Wentland [ Upstream commit cf8837d7204481026335461629b84ac7f4538fa5 ] Unit testing this in VKMS shows that passing 0 into this function returns -1, which is highly counter- intuitive. Fix it by checking whether the input is >= 0 instead of > 0. Fixes: 64566b5e767f ("drm: Add drm_fixp_from_fraction and drm_fixp2int_ceil") Signed-off-by: Harry Wentland Reviewed-by: Simon Ser Reviewed-by: Melissa Wen Signed-off-by: Melissa Wen Link: https://patchwork.freedesktop.org/patch/msgid/20231108163647.106853-2-harry.wentland@amd.com Signed-off-by: Sasha Levin --- include/drm/drm_fixed.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h index 6ea339d5de088..0c9f917a4d4be 100644 --- a/include/drm/drm_fixed.h +++ b/include/drm/drm_fixed.h @@ -95,7 +95,7 @@ static inline int drm_fixp2int_round(s64 a) static inline int drm_fixp2int_ceil(s64 a) { - if (a > 0) + if (a >= 0) return drm_fixp2int(a + DRM_FIXED_ALMOST_ONE); else return drm_fixp2int(a - DRM_FIXED_ALMOST_ONE); -- 2.43.0