From patchwork Mon Dec 16 06:13:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 3352081 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3D7799F3EE for ; Mon, 16 Dec 2013 06:13:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4B88920380 for ; Mon, 16 Dec 2013 06:13:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 6D07D2037F for ; Mon, 16 Dec 2013 06:13:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED348FAB24; Sun, 15 Dec 2013 22:13:29 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-bk0-f43.google.com (mail-bk0-f43.google.com [209.85.214.43]) by gabe.freedesktop.org (Postfix) with ESMTP id 17941FA6F0; Sun, 15 Dec 2013 22:13:26 -0800 (PST) Received: by mail-bk0-f43.google.com with SMTP id mz12so2139283bkb.2 for ; Sun, 15 Dec 2013 22:13:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=Sc4F1pjyGewKinvnL9HtQzVN4k3cHjjKGWaAQCjPO4Y=; b=KkbymzUGY+J/MfksSGwxKSthcmCyKsymxUsYigmozhIGT2FVM8p98nLwiKwOtB90b9 H9tAFB+gleYe4U80T/2sHWCRbUi8dbsOOzPMEO+4TWYf7ZQc2a4JaKOtq+dhxa8ekHZ1 qOvOucpxbVerYsO9sBP9c0ovTy6Uoq2nvVE/u+Ns3A9KxrjQyjxSMxNtzQKmbPxuWVFL Mjizl0D+dqnQt1q+06j5xot+3w9JugtfFoMT5MAJy2XYgBvXlyh4Ep1SUrIx3FDCOy9p 33hUZYmOpRdalk8LkOokAyIB0gcTSu6V5g/cZcoDDT2HMv5hfNL3vl7qUf1MlWw8qEx2 nalQ== MIME-Version: 1.0 X-Received: by 10.204.101.68 with SMTP id b4mr4522356bko.20.1387174405845; Sun, 15 Dec 2013 22:13:25 -0800 (PST) Received: by 10.204.74.130 with HTTP; Sun, 15 Dec 2013 22:13:25 -0800 (PST) Date: Mon, 16 Dec 2013 14:13:25 +0800 Message-ID: From: Wei Yongjun To: daniel.vetter@ffwll.ch, airlied@linux.ie Cc: yongjun_wei@trendmicro.com.cn, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [Intel-gfx] [PATCH -next] drm/i915: fix return value check of debugfs_create_file() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org 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. Signed-off-by: Wei Yongjun Reviewed-by: Damien Lespiau --- drivers/gpu/drm/i915/i915_debugfs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 7008aac..856e18b 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -1920,8 +1920,8 @@ static int i915_pipe_crc_create(struct dentry *root, struct drm_minor *minor, info->dev = dev; ent = debugfs_create_file(info->name, S_IRUGO, root, info, &i915_pipe_crc_fops); - if (IS_ERR(ent)) - return PTR_ERR(ent); + if (!ent) + return -ENOMEM; return drm_add_fake_info_node(minor, ent, info); } @@ -2931,8 +2931,8 @@ static int i915_forcewake_create(struct dentry *root, struct drm_minor *minor) S_IRUSR, root, dev, &i915_forcewake_fops); - if (IS_ERR(ent)) - return PTR_ERR(ent); + if (!ent) + return -ENOMEM; return drm_add_fake_info_node(minor, ent, &i915_forcewake_fops); } @@ -2949,8 +2949,8 @@ static int i915_debugfs_create(struct dentry *root, S_IRUGO | S_IWUSR, root, dev, fops); - if (IS_ERR(ent)) - return PTR_ERR(ent); + if (!ent) + return -ENOMEM; return drm_add_fake_info_node(minor, ent, fops); }