Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2489422lqp; Sun, 24 Mar 2024 23:15:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWe5c1PRtO3JUVZUNBMJtCoqHGdzabcuNpBes8sf3nmNIPDfZsNqG6gGdhLqHYhVqZHCxvbUa5PlgMus9y1+eW8NtClJgp9GeaZzZGkFQ== X-Google-Smtp-Source: AGHT+IGSOmDoySyc0fVvkLhvFIccIUoL6xnMHS0GzaECb/2C5u9yO0aloy18Z7f/j4x7IPzlbrHM X-Received: by 2002:a17:906:33d6:b0:a48:880b:4c88 with SMTP id w22-20020a17090633d600b00a48880b4c88mr1471410eja.27.1711347330138; Sun, 24 Mar 2024 23:15:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711347330; cv=pass; d=google.com; s=arc-20160816; b=lgo1VrXNYl5jHMdZ+/S5/Y5cHZsQY9j9i6W490eA107Mp0HAVLQbr5sZtFnYhlKxjs JPvYKTyNGolytWRUzKC/ENL1FkJJcCJ5YZU6vdG21LQx1WiAmoTflVC8SfmotztRV6P3 96wfzKykeNJwiIHUOLbNKAI/qgNzs2uAuEicHjeUuhIlRCVsfjWmk6GQUxlqkTm98RcB fGaH73Bjkc7u3uUr/SgSJvpyDgkcxFFacQEfOLpSMAbOa1kSEboMD/rozpFaOSmabb3y 4tnIFEvYhwXKizBJb3b9S5yyFuhS2ZwqOSgEM+SSjjKrYpvAM8opUikmGuv6B6RnjJKo ihDg== 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=VwiT0sZFvnF3Iinf8ZYCL9mLiM5+3bOWKKH0jWlQ9Og=; fh=n3IfhNKiDIvqGGLL5fIgO9PW4+Jypx3PwOIiAfpxfY8=; b=V7eXY81xXYhnCDMS33q+4QneZ0C8gRA5s0G/n1rQG3blUt0oJpHA8yUNglx4mfeUK+ th6NeQvQkuM91tRPzNsx7PyQhbyF7DlbMhtsbq+06dipI90+mDMiQmJumj4iQz2V1ZKD tkaR8V7FO/DSWmtFWISveKJhGVgNfg0mbaOdihGXsv+ISJiDAKAJ9V4qWKq9IVMDqUcq MhEwGsMCuPZlfP5HiDFWYsvoLK04t1cbrbCavNNvE82XiDziumpVoVzMYepF5V/YHGfa hMcJEXHLUAWD/0EYkWyKUAja2TUXhsjCiu+HyZ5Gb+K13qzkXplgFjwWYFTRbRkYepb9 R0+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bNrZhQzr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-114535-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-114535-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ko5-20020a170906aa0500b00a46cc9b7d1csi2234363ejb.605.2024.03.24.23.15.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 23:15:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-114535-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bNrZhQzr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-114535-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-114535-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 am.mirrors.kernel.org (Postfix) with ESMTPS id D95B91F2B6A4 for ; Mon, 25 Mar 2024 06:15:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C42322BF77; Sun, 24 Mar 2024 23:50:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bNrZhQzr" 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 1C4C914A08E; Sun, 24 Mar 2024 23:16:07 +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=1711322168; cv=none; b=cJQ5MWI/qKZut2lQnr1ZFd2ZUry7JuEgaBAmyUg8umo5V5sx2eV+4gH18OwfCK9RKRN8JrC9kzNopY3zZ1BwbfuuLvK95opETyd8dN/2hGmetJmJmvtDYcStIZaztS+67/Cw1V0oMYYi2AlsIql8QAxTVevHBwuDmzM5kl9zlGQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322168; c=relaxed/simple; bh=KwT+Jadw65672/zjmUvOIOc9f3vzYLmL/4riuvvi1Yo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qszj5l7wi1iRvrOHPpAGqwqk/jPmj7Jc4W2t/siSXTGUsU+P1fxdOT9TLp9ZC7L0LE0aJlG0144fgxpBqXw3LqpSiWmHdDNKChJIz3eJUF+PdFrbssg05oRuHI5mslti7Z/mmxgW05JD2jbRFGQ6+5Q7notkNt9t5SN4dbXbBA4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bNrZhQzr; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31B6CC433C7; Sun, 24 Mar 2024 23:16:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322167; bh=KwT+Jadw65672/zjmUvOIOc9f3vzYLmL/4riuvvi1Yo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bNrZhQzr49LwiaWQPKNZ14Ixt3ZHKMkSth+XvPvZC850lddCFgD2FCyzneKwXGS7C OKslId0Zunhml6D8Ac50gDYtQ22tgBHXG6Jf97P5pAv8d7XcYZmCN7ZsAChSdFPrqL hxPp3gDnYwz2J3kmu2Q8OGSlryQ6B+qxuEOHS/mcs5mhcH3erZKqG3GhichswqypHL ttlKZbJRuHj1jsn1b52QRv5qXkDfwTtWH7m3Cy/Rjd3iOLSoOClBSa6jTsXij6bNG3 6OCp/2xyIVkwlV/rVak6Us2j9DNhYxfWhkecKnCTppNYfhCv1n+00MgzyFwfO49eIt E7SLGhrvBm+Sg== 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.1 245/451] drm: Don't treat 0 as -1 in drm_fixp2int_ceil Date: Sun, 24 Mar 2024 19:08:41 -0400 Message-ID: <20240324231207.1351418-246-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-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 03cb890690e83..6230088428cdb 100644 --- a/include/drm/drm_fixed.h +++ b/include/drm/drm_fixed.h @@ -94,7 +94,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