From patchwork Thu Jul 9 15:49:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 235211 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp220720ilg; Fri, 10 Jul 2020 00:53:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbkuq8S36rnihioW4QRCDb+6uReTrei/mL00UvzJe/zdE5woHA8SA93jtO7GvGgwWXPn4u X-Received: by 2002:a63:b50e:: with SMTP id y14mr26023550pge.416.1594367616919; Fri, 10 Jul 2020 00:53:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594367616; cv=none; d=google.com; s=arc-20160816; b=CV+7UNTV9aK9y9QBXl3cjMj8JN+qeOhz+XjF89OUboYLDg7F9Pja86nMFdYWSeT4xZ NMJfgc33yy/fiBpKzyeb/O5rqS8SYe5h9gjKQ89EvgIb3gXo1CTIClU2BCfkemF1VH6d nE2s3rNLQv33Cv/XVSJrb/PeODk0+3YClhZFlem4Zryhlava8cNcg5ktLyhA+HUkXR// MSTwBfbfoiY/aBv2RfRAMsyx2tXsGXKWGX4D9nAJptD3pocULjWFaGrR3HYTAPJlP/o9 2xqB0himmX5NOaIGrgwfO8kzXrBjbbxdSHFBN6k5mVk2Yi3I4HEO6mt3S0tMsSa4sHU/ op2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:message-id:date:subject:to:from:delivered-to; bh=ICceiCFEH2cwSg5O2khHIy+2kC/bnTECOipHOmLkm5s=; b=VMhy4NFsVbzgccalNX+6Ir1ybAvYieeREBch3085vsDhcXl5559DUrTzWyXRdaxWoV H3+0jmAaEoqGKbJmwUFIMtJAGxaSzlAU3sCEqVKMO7lBKCuPwV8uVgLoaKijxbaEla8o 8Ly8DIPl50/2LUnLp0lDB1E1ggmjsLDvNDgq0Vca0tSdb4JDqa40HfBd0TTFBlnyAqGp wsGjDp0YH+7VqBdFwWRYSZNSrFhD5aU5ng2PDK71SsisnmWfhr/KXTrvrFY4aI/WB5dC lQrBxF13xOEYZlAZI4HBz+/q6Mg43O6cwGh6HiPbaKNnPywD1I5CHTwgEIi1cEUPXLQB WD0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id j62si3738694pge.89.2020.07.10.00.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 00:53:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 71B6B6EBA0; Fri, 10 Jul 2020 07:53:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 3560A6E0C5; Thu, 9 Jul 2020 15:49:35 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C1FD331B; Thu, 9 Jul 2020 08:49:34 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5691F3F792; Thu, 9 Jul 2020 08:49:33 -0700 (PDT) From: Sudeep Holla To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH] drm/i915/selftests: Fix compare functions provided for sorting Date: Thu, 9 Jul 2020 16:49:31 +0100 Message-Id: <20200709154931.23310-1-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Fri, 10 Jul 2020 07:52:58 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sudeep Holla , Andi Shyti , David Airlie , Mika Kuoppala , Chris Wilson , Rodrigo Vivi MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Both cmp_u32 and cmp_u64 are comparing the pointers instead of the value at those pointers. This will result in incorrect/unsorted list. Fix it by deferencing the pointers before comparison. Cc: Chris Wilson Cc: Mika Kuoppala Signed-off-by: Sudeep Holla --- drivers/gpu/drm/i915/gt/selftest_rps.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Hi, I am not sure if I can put 2 fixes tags, but these are the ones affected. Fixes: 4ba74e53ada3 ("drm/i915/selftests: Verify frequency scaling with RPS") Fixes: 8757797ff9c9 ("drm/i915/selftests: Repeat the rps clock frequency measurement") I made similar mistake and after I fixed it, just looked if there are any similar bugs and found this. Regards, Sudeep -- 2.17.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel diff --git a/drivers/gpu/drm/i915/gt/selftest_rps.c b/drivers/gpu/drm/i915/gt/selftest_rps.c index 5049c3dd08a6..c91981e75ebf 100644 --- a/drivers/gpu/drm/i915/gt/selftest_rps.c +++ b/drivers/gpu/drm/i915/gt/selftest_rps.c @@ -44,9 +44,9 @@ static int cmp_u64(const void *A, const void *B) { const u64 *a = A, *b = B; - if (a < b) + if (*a < *b) return -1; - else if (a > b) + else if (*a > *b) return 1; else return 0; @@ -56,9 +56,9 @@ static int cmp_u32(const void *A, const void *B) { const u32 *a = A, *b = B; - if (a < b) + if (*a < *b) return -1; - else if (a > b) + else if (*a > *b) return 1; else return 0;