Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2381124lqp; Sun, 24 Mar 2024 16:54:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUNZEcgOBViyNzzGAydfDlS0IBb4zZVmDBGXjhvk1fttjAXlY+rIeKUufZDKxRvgKWbeOQ2LzMqkjiL5QqOlrkiy+fzBaP0W0bWs5s68w== X-Google-Smtp-Source: AGHT+IHAiu3z3EFItXb4PKAHUQPsNpVd7HwSajACDxn4KJdHKw8j7/mAlU6YE4XVl7nWfAg6Xx1h X-Received: by 2002:ac8:598a:0:b0:431:5b06:c2ae with SMTP id e10-20020ac8598a000000b004315b06c2aemr987961qte.56.1711324449729; Sun, 24 Mar 2024 16:54:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711324449; cv=pass; d=google.com; s=arc-20160816; b=gU6Rs7eXKmCrzVIpd0+VWPy8wZed8vPS3j7mn9cFh2Cg11T8WMh96090I5UOfhN86G q6Z878czM0OpwfqqawqfhJJ+E0boM1FSeFFbqfj5NsQYHplq6NAxD80fxDVoZenaF4wa awaQdKisV9jZocVdc6+bdP4Qe97en60mloLoSKqh5nY63GIOeU5eGPlhTUaRi9moQw4w UwEv8A85sAUcAFzmQkSvHUn/VBoZu+jiLPf7U+TzaXdNXaphCC+Uremauuk65Zla35Ox XvUlmAm4SFgieGwZamUVDsvKCXVOCojpdQt0j/9G6sbEygqJa3/2Jd4l5lqF7yo6I8my eBFQ== 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=FooYA5jfj1VEPRJNMIlbsOlYLZMcX0b0xBWjlyldRuVY/niQPj7lc16wiGbf0R66b+ d/BpItXFGpCBAPGhfMqmJd8VLJNk0nHVMu6JUQNCvhDUqSdi+iSfzDqdts1bJLv4yiYj 3mRZKw++fly13s7CdSWAvSaCl1mTzE5RZ3eGaJy/oMorilZp9V35qLv3eweGhdL1tRbK XLhNuM8CAkl/i+Lq+rJIk50zZYZYXVz7sMSkhDW4Y3406ksMWipadyxP2ZeLaIf//UDa 2pKSA54p2rCOi14Px1626MPh+zgK4aWtIgawPsKgVZG29KlN1RfwXkEAdD0s43AJHkfp qHHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iZQUWZLl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113250-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113250-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id fa15-20020a05622a4ccf00b00430d4945bd5si4525897qtb.572.2024.03.24.16.54.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 16:54:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113250-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iZQUWZLl; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113250-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113250-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7573F1C22D19 for ; Sun, 24 Mar 2024 23:54:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2FDBB1870A2; Sun, 24 Mar 2024 22:40:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iZQUWZLl" 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 412A31869EA; Sun, 24 Mar 2024 22:40:50 +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=1711320050; cv=none; b=U9hy9hl4e13IQB3gxG4c7OE8OmnrXK+Civ76Ovq1Zp6V6lCZfrLe5/P7MjI85MyFVE1m8wBWwqRsaw2h5aysfTfz6lZYMUrrP6phWreVHFhuwfqDzzcB8iU67p4iZoLL1/iDxoyoKXsWc5GF4GK9yCr+IULAwtf0eIMYowz6Wds= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320050; c=relaxed/simple; bh=qgWoNH854Qu3UszLlD0IS5mUljLWw9/aZEUoPzuQfUA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lIFxVyx3xL1nTvYeBlQaCQSqO3c7NxGlNtVJNyzYYQPBegj43AHKSI+k6zh934dokfSI5GUtY0x/Ul+L3wiQOy4Ujz8fjvfg89gJxEIA6elnvcS2DMobdO+XzE72ThguRvnFRqaEZsmR3OQUau/ptiiDyN7uKo7uuirId/Kaiys= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iZQUWZLl; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56518C43394; Sun, 24 Mar 2024 22:40:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320050; bh=qgWoNH854Qu3UszLlD0IS5mUljLWw9/aZEUoPzuQfUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iZQUWZLl+MCtemuDY6dpidcM1VV4YWKWqLMDYDdck2/36OGY+Y2ZgZHP35PaMc8Wn AheqCxGyDS0mLV/hys35fDSZGfcTRVRIyj/czzw+dy/Hqh3LlCU5MaWOQwr1gETqa9 3GjlQTFhSUCKxjftCiduIAF1wedsp8R2Yz3k9AGnY6xgZQnQ2BFk9NmdlyYvLbWH7K U1pSvzKm3+1BP7HEaAmjO/KVCNkku8BJlWbYA0L8BMH1U+MgYUzFkBWlm2fSlkocZm GSRGGSlAqGXXFyaesXyRoCU8e/H0idkQpBzjviTa6gkui6fNkh3B4d/KWQ10iN5g9I kC3jwuqNhq/dQ== 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.8 359/715] drm: Don't treat 0 as -1 in drm_fixp2int_ceil Date: Sun, 24 Mar 2024 18:28:58 -0400 Message-ID: <20240324223455.1342824-360-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-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