Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1505356ybz; Thu, 30 Apr 2020 00:06:12 -0700 (PDT) X-Google-Smtp-Source: APiQypJdb6FWDnHb5RscHRgTMaqYkjgJoO2HVfkzNoAuoWYZFGnfpNi2gv49DXlz8gLagVEpzghv X-Received: by 2002:aa7:d513:: with SMTP id y19mr1380895edq.367.1588230372364; Thu, 30 Apr 2020 00:06:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588230372; cv=none; d=google.com; s=arc-20160816; b=Xjl9Znp1WpYPeeq2jcWAk/ZNILhgi1UGihUmsOr1R0LpxejYLfMq1krQMCFSBcl8Cz PMUHGHfvfMn2GhHnqS7CI1P8GqEQHgdSq2MeNSaPbGRtiVxh6j3ks7/aUMAOghzXVF0B 9W8NdQxtHhPAC8oMA3/zc8Oq3WOsML9nkQ2J6i9tIrpF+ietMWc+CmxxLvRIqgRwqtpC PHFtjtksnVt5haKQJAHUds+DZh3uiI/YiLBsl3oJjuh9IlPnYCYgeC3jnAwRp+Bhc7iC dwIQ9MeIThNX1CZDYPUbFeiZU+JiwmA+m1zCPsoXn0kHvekBnhHqL2X1+vlyl3BjWtWc /DWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Ee2rYnvOzyDwPgPVKK66JqXtLHRHq4E1pVaEbkafYOM=; b=kwKIyu/7ZjJDSzuR2tSTkESebqFhTbW1lKvuZ64zQPdkc1HQA1NtZ5HWtuMIK8NroP /itgLw8oxbRX6ylk6HHbspto0W+RlH3YJloT7XEmZ8iXD3seVF++ZNzrhGRNntmh7lvW mXHNxt+ambQt5U46ffijkyaUTBYQk1ZvhQOaU352sl72axBWh8SwBK9gKe1JqrS33C8Y CGg4V7WEVCnTkYL8vt0zRqbntizVBskgEtIwy1s6FvtOdSgGGJBBkVFHBeOsO6FRwhjD sQ2Otv99hyYv9GqPfcrZdRTrk4hgxO8GUZ4iVXJPDCTJxmWme3oaP0zQOp/zRw0PY5Lk BLZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y7si5369966ede.225.2020.04.30.00.05.48; Thu, 30 Apr 2020 00:06:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726572AbgD3HEV (ORCPT + 99 others); Thu, 30 Apr 2020 03:04:21 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3347 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726337AbgD3HEV (ORCPT ); Thu, 30 Apr 2020 03:04:21 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 75443E6259D20B6A35F4; Thu, 30 Apr 2020 15:04:19 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Thu, 30 Apr 2020 15:04:13 +0800 From: Wei Yongjun To: Hans de Goede , David Airlie , Daniel Vetter , Daniel Vetter CC: Wei Yongjun , , , Subject: [PATCH -next] drm/vboxvideo: Fix a NULL vs IS_ERR() check in vbox_hw_init() Date: Thu, 30 Apr 2020 07:05:23 +0000 Message-ID: <20200430070523.185584-1-weiyongjun1@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The devm_gen_pool_create() function returns ERR_PTR() on error, it doesn't return NULL so this check doesn't work. Fixes: 4cc9b565454b ("drm/vboxvideo: Use devm_gen_pool_create") Signed-off-by: Wei Yongjun --- drivers/gpu/drm/vboxvideo/vbox_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vboxvideo/vbox_main.c b/drivers/gpu/drm/vboxvideo/vbox_main.c index d68d9bad7674..c5ea880d17b2 100644 --- a/drivers/gpu/drm/vboxvideo/vbox_main.c +++ b/drivers/gpu/drm/vboxvideo/vbox_main.c @@ -123,8 +123,8 @@ int vbox_hw_init(struct vbox_private *vbox) /* Create guest-heap mem-pool use 2^4 = 16 byte chunks */ vbox->guest_pool = devm_gen_pool_create(vbox->ddev.dev, 4, -1, "vboxvideo-accel"); - if (!vbox->guest_pool) - return -ENOMEM; + if (IS_ERR(vbox->guest_pool)) + return PTR_ERR(vbox->guest_pool); ret = gen_pool_add_virt(vbox->guest_pool, (unsigned long)vbox->guest_heap,