From patchwork Tue Jul 19 12:15:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: weiyj_lk@163.com X-Patchwork-Id: 9237631 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 565166075D for ; Tue, 19 Jul 2016 14:30:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46F9C27569 for ; Tue, 19 Jul 2016 14:30:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BC1E2766D; Tue, 19 Jul 2016 14:30:58 +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_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]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4B5B27569 for ; Tue, 19 Jul 2016 14:30:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D10D36E22C; Tue, 19 Jul 2016 14:30:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from m12-16.163.com (m12-16.163.com [220.181.12.16]) by gabe.freedesktop.org (Postfix) with ESMTP id 70F706E67F for ; Tue, 19 Jul 2016 12:16:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=Nho+D 1Fd4RogNcG39Et64ffws2BDPCatna7PzkvaZ9E=; b=e3qeRp3xXoO5i2QWfaiaf +5vOEJZesxIEgHKrV4+MmW3cl87b7hw74ddUpQfvtmnBN8JcT70PjxfFwTpX3+Sd 5WRR4kEho4T+DjK9KxRBV0n4wcbD+u+fjHcijOOX75FStwKoJfHfZl2BhoxmrR2l /qiC0CSieuDSNvvXNpyU4k= Received: from localhost.localdomain.localdomain (unknown [180.110.255.208]) by smtp12 (Coremail) with SMTP id EMCowABXZ5fmGY5Xe36AAQ--.37612S2; Tue, 19 Jul 2016 20:15:34 +0800 (CST) From: Wei Yongjun To: alexander.deucher@amd.com, christian.koenig@amd.com, airlied@linux.ie, David1.Zhou@amd.com, Felix.Kuehling@amd.com, Jammy.Zhou@amd.com Subject: [PATCH -next] drm/amdgpu: fix return value check in amdgpu_ttm_debugfs_init() Date: Tue, 19 Jul 2016 12:15:34 +0000 Message-Id: <1468930534-10432-1-git-send-email-weiyj_lk@163.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-CM-TRANSID: EMCowABXZ5fmGY5Xe36AAQ--.37612S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxJF17Jr43ZrW3GF4DtF1UWrg_yoW8GF1kpa nYvFyqqry8Zw17t348AF48Xr9Yv3Z2qFyxGrWUuwnY934rJr4rtw43JrW5Xr97urZ7urWS qFZ0g3yUX3ZFvF7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jLjjDUUUUU= X-Originating-IP: [180.110.255.208] X-CM-SenderInfo: pzhl5yxbonqiywtou0bp/1tbivwer1lWBTBMiDgAAsi X-Mailman-Approved-At: Tue, 19 Jul 2016 14:30:31 +0000 Cc: Wei Yongjun , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Wei Yongjun In case of error, the function debugfs_create_file() returns NULL pointer not ERR_PTR() if debugfs is enabled. The IS_ERR() test in the return value check should be replaced with NULL test. (defined(CONFIG_DEBUG_FS) make sure debugfs is enabled) Signed-off-by: Wei Yongjun --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index b7742e6..8c569ea 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -1345,16 +1345,16 @@ static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev) ent = debugfs_create_file("amdgpu_vram", S_IFREG | S_IRUGO, root, adev, &amdgpu_ttm_vram_fops); - if (IS_ERR(ent)) - return PTR_ERR(ent); + if (!ent) + return -ENOMEM; i_size_write(ent->d_inode, adev->mc.mc_vram_size); adev->mman.vram = ent; #ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS ent = debugfs_create_file("amdgpu_gtt", S_IFREG | S_IRUGO, root, adev, &amdgpu_ttm_gtt_fops); - if (IS_ERR(ent)) - return PTR_ERR(ent); + if (!ent) + return -ENOMEM; i_size_write(ent->d_inode, adev->mc.gtt_size); adev->mman.gtt = ent;