From patchwork Wed Oct 19 16:18:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9384771 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E35A260487 for ; Wed, 19 Oct 2016 16:18:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4F8129935 for ; Wed, 19 Oct 2016 16:18:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C97B329A43; Wed, 19 Oct 2016 16:18:22 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID 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 1661029935 for ; Wed, 19 Oct 2016 16:18:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 19FB86E974; Wed, 19 Oct 2016 16:18:21 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8CC116E974; Wed, 19 Oct 2016 16:18:19 +0000 (UTC) Received: by mail-pf0-x241.google.com with SMTP id 128so2875610pfz.1; Wed, 19 Oct 2016 09:18:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dtCGZ6d2PudbUVmnkdDHOgs9Wdg9e0uQPNsEYRlosaA=; b=vnMV42M1gCvLQeAuCdJtC1yK/52y5zX2N0/2ivWijGoccasmdHJmVArhvNU96jim44 XNoQRt5JjonDAZY3VRPbw8ZIocNVK2iO4b7D92+cXAUOHVg97+yzUNq0zaXKn7Wndn0+ l0o7faeU9oTx2eLKDasxelffobghKffGDzqn2G7le5qo2PcV4huL9FPTMK9lSm1KXv2D t2fmFLnOhP2gkJwI1eGodpu52xqKkz0yXow0xYu9CpbEPDHe3tmyoP42AqPCoqiEbBNo JWcabeS6heBPGP3LLtSD8FFUI0suvoiw2RmBnDYXdkm/ja3QtOLND1OugkmpY/AE/kuu HaKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dtCGZ6d2PudbUVmnkdDHOgs9Wdg9e0uQPNsEYRlosaA=; b=jvsSsjv35Xwvpu/MgMxNP/puO8Q+2t4Z91tgho1M6QJMSrKevrowezQ/aUPF3jPhYP rSKI5zsY0WCXZaJnVlt5BBAOEcMU/8sNT7ktDwEHJRjkieI/vwMCRHhYBb8qkUbxfW1L RbyjHq5ZnDeqyBQT0Np/om7VxSASZxG6cmSkn0fSMtFUAN8ph8KciS1D55kiLxrMNuHm pWo4whbDNeG4vAoIrJWchwcxs6psbWEZ9JuyrkNtL1BNULrm52IIASpkpdgN9bOd2FGI mBwlnUdxG9N7U/7XAYe9MvMAVLvZkCqgLiEgT/ltiqjBQimNsoorKUEA/8aDBrcnkLpt txsg== X-Gm-Message-State: AA6/9RlCQPoJiqbLdWqpeNILm1V17EiKNX4+8Qoq6HBWfWNt1WdUVRF9Px++6YfcjOeD7A== X-Received: by 10.99.153.17 with SMTP id d17mr10504706pge.122.1476893898961; Wed, 19 Oct 2016 09:18:18 -0700 (PDT) Received: from 192.168.0.37 (ec2-52-192-197-227.ap-northeast-1.compute.amazonaws.com. [52.192.197.227]) by smtp.gmail.com with ESMTPSA id h8sm65252164pab.9.2016.10.19.09.18.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Oct 2016 09:18:18 -0700 (PDT) From: Wei Yongjun To: Daniel Vetter , Jani Nikula , David Airlie , Yulei Zhang , Zhenyu Wang , Zhi Wang Date: Wed, 19 Oct 2016 16:18:03 +0000 Message-Id: <1476893883-8096-1-git-send-email-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Cc: intel-gfx@lists.freedesktop.org, Wei Yongjun , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH -next] drm/i915/gvt: fix return value check X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Wei Yongjun In case of error, the function i915_gem_object_create() returns ERR_PTR() not NULL. The NULL test in the return value check should be replaced with IS_ERR(). Signed-off-by: Wei Yongjun --- drivers/gpu/drm/i915/gvt/cmd_parser.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c index 5808ee7..6abb2a6 100644 --- a/drivers/gpu/drm/i915/gvt/cmd_parser.c +++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c @@ -1640,8 +1640,8 @@ static int perform_bb_shadow(struct parser_exec_state *s) entry_obj->obj = i915_gem_object_create(&(s->vgpu->gvt->dev_priv->drm), round_up(bb_size, PAGE_SIZE)); - if (entry_obj->obj == NULL) - return -ENOMEM; + if (IS_ERR(entry_obj->obj)) + return PTR_ERR(entry_obj->obj); entry_obj->len = bb_size; INIT_LIST_HEAD(&entry_obj->list); @@ -2712,8 +2712,8 @@ static int shadow_indirect_ctx(struct intel_shadow_wa_ctx *wa_ctx) wa_ctx->indirect_ctx.obj = i915_gem_object_create(dev, round_up(ctx_size + CACHELINE_BYTES, PAGE_SIZE)); - if (wa_ctx->indirect_ctx.obj == NULL) - return -ENOMEM; + if (IS_ERR(wa_ctx->indirect_ctx.obj)) + return PTR_ERR(wa_ctx->indirect_ctx.obj); ret = i915_gem_object_get_pages(wa_ctx->indirect_ctx.obj); if (ret)