From patchwork Fri Jul 16 01:11:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 478208 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp847577jao; Thu, 15 Jul 2021 18:12:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz+FrO2bg7p5NPRA3LcYfKrdKqc1xPu0DuuYu1nkN86xuGXvHeByXZmrLjYxaYSiL3jkPg X-Received: by 2002:a63:ee06:: with SMTP id e6mr7183817pgi.374.1626397920925; Thu, 15 Jul 2021 18:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626397920; cv=none; d=google.com; s=arc-20160816; b=lEvLIjMF+55KnWPeBLYF/+FqeZR2vQpRxyfaFxsmPAsA2prJoFlPao8OlF7+VBotM0 kF6EPCL6AJ3gXtd51qiu3o6JP7qDb4zEG9Rlzs64Tn58JezhYknmQIx4xq7NtR0Hu+K2 7PnuhX/IggWILa0HbbX0sSK+w9XBXdHK9SOl9Ept2uogXKikUs1V0me1usJm6ZuXpa2V Mg7qaoHDGgRvYnrBXGhsEawvDtuF4zGopduelXFt7eYSO8UmmBa2mPOLKyxPI+fmY6xS NE6M9C8D6CXEqMoY7Wy0v4q5UkaqqlFY2iT7mplDHtT5EK0GXfwBbdNr8vdSGX/zhlcc wlWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:delivered-to; bh=yK4NwQAa15Vc+VfCzoUYrFTUBZlTnUcq/SDAJTnYCKM=; b=ieNIaATUBaZoCOuyVPWlWEt8oLxyQ9a46hvCn32layd6Af6FLRWlcrmd8gM6IZ1Vkv LbKbnj/KRfD+yQhwj92gVfonN2/ZA0NcgbB9n7aW+lweaOfqIDTVeqGq+IFiDcqmanGs uTboqjRyAd12DtiiR7AkXw0iEQb+0CjbnSmBszQg9PzRt773YQHa+vbwblfowOOvfVFm D27dFimnWDQepI6H3wdOEqY/5TQGzgeAlBC4sgoOAL947r54gM4v9kmQ1stHxjJ8V9WE REzO3Wu612kfdxULaaFJFM96zqSA8Yhi69h3QoxVL8JAz4XH2ZqMnTET0f7foV7fDLCN Csiw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id j15si9373961pji.25.2021.07.15.18.12.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jul 2021 18:12:00 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4C5416E8D0; Fri, 16 Jul 2021 01:11:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by gabe.freedesktop.org (Postfix) with ESMTPS id 22DB76E8D0; Fri, 16 Jul 2021 01:11:54 +0000 (UTC) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4GQtR46G3WzZkts; Fri, 16 Jul 2021 09:08:32 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 16 Jul 2021 09:11:51 +0800 Received: from thunder-town.china.huawei.com (10.174.179.0) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 16 Jul 2021 09:11:50 +0800 From: Zhen Lei To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , intel-gfx , dri-devel , linux-kernel Subject: [PATCH] drm/i915: Fix error return code in igt_vma_create() Date: Fri, 16 Jul 2021 09:11:12 +0800 Message-ID: <20210716011112.3305-1-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.179.0] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected 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: Zhen Lei Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Although 'err' has been initialized to -ENOMEM, but it will be reassigned by the "err = create_vmas(...)" statement in the for loop. So that, the value of 'err' may be zero when i915_gem_object_create_internal() or mock_context() failed. Fix to reassign 'err' before 'goto out'. Fixes: e3c7a1c5377e ("drm/i915: Test creation of VMA") Reported-by: Hulk Robot Signed-off-by: Zhen Lei --- drivers/gpu/drm/i915/selftests/i915_vma.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/drivers/gpu/drm/i915/selftests/i915_vma.c b/drivers/gpu/drm/i915/selftests/i915_vma.c index dd0607254a95..96771c341f29 100644 --- a/drivers/gpu/drm/i915/selftests/i915_vma.c +++ b/drivers/gpu/drm/i915/selftests/i915_vma.c @@ -156,7 +156,7 @@ static int igt_vma_create(void *arg) IGT_TIMEOUT(end_time); LIST_HEAD(contexts); LIST_HEAD(objects); - int err = -ENOMEM; + int err; /* Exercise creating many vma amonst many objections, checking the * vma creation and lookup routines. @@ -166,8 +166,10 @@ static int igt_vma_create(void *arg) for_each_prime_number(num_obj, ULONG_MAX - 1) { for (; no < num_obj; no++) { obj = i915_gem_object_create_internal(i915, PAGE_SIZE); - if (IS_ERR(obj)) + if (IS_ERR(obj)) { + err = PTR_ERR(obj); goto out; + } list_add(&obj->st_link, &objects); } @@ -176,8 +178,10 @@ static int igt_vma_create(void *arg) for_each_prime_number(num_ctx, 2 * BITS_PER_LONG) { for (; nc < num_ctx; nc++) { ctx = mock_context(i915, "mock"); - if (!ctx) + if (!ctx) { + err = -ENOMEM; goto out; + } list_move(&ctx->link, &contexts); }