From patchwork Wed Aug 7 12:28:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 11082023 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 044CD13B1 for ; Wed, 7 Aug 2019 12:29:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5D671FE8D for ; Wed, 7 Aug 2019 12:29:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9D6E22701; Wed, 7 Aug 2019 12:29:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8494E1FE8D for ; Wed, 7 Aug 2019 12:29:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F3A106E6C0; Wed, 7 Aug 2019 12:28:59 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8A0766E6C0; Wed, 7 Aug 2019 12:28:58 +0000 (UTC) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x77CJ2Qw002975; Wed, 7 Aug 2019 12:28:48 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 2u52wrbyxx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 07 Aug 2019 12:28:48 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x77CHtEf159810; Wed, 7 Aug 2019 12:28:47 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 2u75bwd2q9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 07 Aug 2019 12:28:47 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x77CSfHG019271; Wed, 7 Aug 2019 12:28:41 GMT Received: from mwanda (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 07 Aug 2019 05:28:40 -0700 Date: Wed, 7 Aug 2019 15:28:32 +0300 From: Dan Carpenter To: Jani Nikula , Chris Wilson Message-ID: <20190807122832.GA10517@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.10.1 (2018-07-13) X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9341 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908070137 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9341 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908070137 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=skuCuQ4hN4RPMv++ey4fYGda1N9xL/Wcg5MzIe+uAfE=; b=4ZJ4+w1r8LbQyQgSg8Zfv9Oyffgz612/+TCaNqaDK8Wc5F+KKZNwUIuoJI+RPJnrlyz4 xzjQxQjut1SqlUG7DDesFkK3UP5dme0/1LaP7sRxDEnSKkY3ZFAXXfeMtBWj+Dy9560R qU2gY2jMHeinUCLibu+q2CStrY10rijQMp815n/btXavrE8Z5WzZIsMjpWdIUqFNiBEb I+8GMrDB1tOlwRrstH5aq2OCVcMrQ51s0koA56FcloaHsX8yBS99IQzRog4e3MqyRNBo qflQu8WY5dtWO6NCX0Bl1f/c8ZVO/a2NEEZ7+WLUwJGocSjpzfu7H+paqrF5F+bEQkLQ Kg== Subject: [Intel-gfx] [PATCH] drm/i915: Fix some NULL vs IS_ERR() conditions X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , intel-gfx@lists.freedesktop.org, kernel-janitors@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP There were several places which check for NULL when they should have been checking for IS_ERR(). Fixes: d8af05ff38ae ("drm/i915: Allow sharing the idle-barrier from other kernel requests") Signed-off-by: Dan Carpenter Reviewed-by: Chris Wilson --- drivers/gpu/drm/i915/gt/selftest_context.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/selftest_context.c b/drivers/gpu/drm/i915/gt/selftest_context.c index d39b5594cb02..6e7e9a6fd235 100644 --- a/drivers/gpu/drm/i915/gt/selftest_context.c +++ b/drivers/gpu/drm/i915/gt/selftest_context.c @@ -86,8 +86,8 @@ static int __live_active_context(struct intel_engine_cs *engine, } ce = intel_context_create(fixme, engine); - if (!ce) - return -ENOMEM; + if (IS_ERR(ce)) + return PTR_ERR(ce); for (pass = 0; pass <= 2; pass++) { struct i915_request *rq; @@ -161,8 +161,8 @@ static int live_active_context(void *arg) mutex_lock(>->i915->drm.struct_mutex); fixme = live_context(gt->i915, file); - if (!fixme) { - err = -ENOMEM; + if (IS_ERR(fixme)) { + err = PTR_ERR(fixme); goto unlock; } @@ -226,12 +226,12 @@ static int __live_remote_context(struct intel_engine_cs *engine, */ remote = intel_context_create(fixme, engine); - if (!remote) - return -ENOMEM; + if (IS_ERR(remote)) + return PTR_ERR(remote); local = intel_context_create(fixme, engine); - if (!local) { - err = -ENOMEM; + if (IS_ERR(local)) { + err = PTR_ERR(local); goto err_remote; } @@ -274,8 +274,8 @@ static int live_remote_context(void *arg) mutex_lock(>->i915->drm.struct_mutex); fixme = live_context(gt->i915, file); - if (!fixme) { - err = -ENOMEM; + if (IS_ERR(fixme)) { + err = PTR_ERR(fixme); goto unlock; }