From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1FFEC4708F for ; Tue, 1 Jun 2021 09:19:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D031C610C9 for ; Tue, 1 Jun 2021 09:19:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233599AbhFAJVU convert rfc822-to-8bit (ORCPT ); Tue, 1 Jun 2021 05:21:20 -0400 Received: from mga07.intel.com ([134.134.136.100]:48013 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231139AbhFAJVT (ORCPT ); Tue, 1 Jun 2021 05:21:19 -0400 IronPort-SDR: Vn8X6ylzgRw0OywKFL7dL6Eh/q96SmHD6pU8tkbJsai968Bf/V0bhX4SBKb/Nw4NRNT8OGy4xM e7JE9VA0+15A== X-IronPort-AV: E=McAfee;i="6200,9189,10001"; a="267386016" X-IronPort-AV: E=Sophos;i="5.83,239,1616482800"; d="scan'208";a="267386016" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2021 02:19:38 -0700 IronPort-SDR: MRP60Cx5rkw+QlFqxPO0H1pl4Tem49o9plz2f7xwE89uZnAVqM6z75vcxNK2th9PFkTCotEPUt eYMXQu2yM9Zw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,239,1616482800"; d="scan'208";a="416412930" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by orsmga002.jf.intel.com with ESMTP; 01 Jun 2021 02:19:37 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 1 Jun 2021 02:19:37 -0700 Received: from irsmsx604.ger.corp.intel.com (163.33.146.137) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 1 Jun 2021 02:19:36 -0700 Received: from irsmsx604.ger.corp.intel.com ([163.33.146.137]) by IRSMSX604.ger.corp.intel.com ([163.33.146.137]) with mapi id 15.01.2242.008; Tue, 1 Jun 2021 10:19:35 +0100 From: "Ursulin, Tvrtko" To: Zhihao Cheng , "jani.nikula@linux.intel.com" , "joonas.lahtinen@linux.intel.com" , "Vivi, Rodrigo" , "airlied@linux.ie" , "daniel@ffwll.ch" , "chris@chris-wilson.co.uk" CC: "intel-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , "yukuai3@huawei.com" Subject: RE: [PATCH] drm/i915/selftests: Fix return value check in live_breadcrumbs_smoketest() Thread-Topic: [PATCH] drm/i915/selftests: Fix return value check in live_breadcrumbs_smoketest() Thread-Index: AQHXVEJ+tkVXHh6hkECEwuczk5ho4qr+5blA Date: Tue, 1 Jun 2021 09:19:35 +0000 Message-ID: <33c46ef24cd547d0ad21dc106441491a@intel.com> References: <20210529043327.2772051-1-chengzhihao1@huawei.com> In-Reply-To: <20210529043327.2772051-1-chengzhihao1@huawei.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 x-originating-ip: [10.184.70.1] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [Don't see this on intel-gfx so I have to reply with top post.] Reviewed-by: Tvrtko Ursulin Regards, Tvrtko -----Original Message----- From: Zhihao Cheng Sent: Saturday, May 29, 2021 5:33 AM To: jani.nikula@linux.intel.com; joonas.lahtinen@linux.intel.com; Vivi, Rodrigo ; airlied@linux.ie; daniel@ffwll.ch; chris@chris-wilson.co.uk; Ursulin, Tvrtko Cc: intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org; chengzhihao1@huawei.com; yukuai3@huawei.com Subject: [PATCH] drm/i915/selftests: Fix return value check in live_breadcrumbs_smoketest() In case of error, the function live_context() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: 52c0fdb25c7c9 ("drm/i915: Replace global breadcrumbs ...") Reported-by: Hulk Robot Signed-off-by: Zhihao Cheng --- drivers/gpu/drm/i915/selftests/i915_request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c index ee8e753d98ce..eae0abd614cb 100644 --- a/drivers/gpu/drm/i915/selftests/i915_request.c +++ b/drivers/gpu/drm/i915/selftests/i915_request.c @@ -1592,8 +1592,8 @@ static int live_breadcrumbs_smoketest(void *arg) for (n = 0; n < smoke[0].ncontexts; n++) { smoke[0].contexts[n] = live_context(i915, file); - if (!smoke[0].contexts[n]) { - ret = -ENOMEM; + if (IS_ERR(smoke[0].contexts[n])) { + ret = PTR_ERR(smoke[0].contexts[n]); goto out_contexts; } } -- 2.25.4