Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp400965ybe; Wed, 4 Sep 2019 22:54:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQPYuERh+HvVuGTSDI2YcUl0zq/RvMib34YeUeUdX4qNE+dYHhntu1EK3QR6GR1Qcw9F1g X-Received: by 2002:a65:52ca:: with SMTP id z10mr1639881pgp.424.1567662874918; Wed, 04 Sep 2019 22:54:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567662874; cv=none; d=google.com; s=arc-20160816; b=K6Iupos4ZV1icul9y6xnVhRnwYKLpUNmfVlXCpkXdLqJsAyIxxhYTdhQEufD3kP7Lb t8FtaiYPkpx98HweozMb7+YWw4+4w/2ZEGY1RYxs13uW8SyE/IDwPxOLKWSYdUwnWxeW KTnmc55dp2tVjSr2jAHL0MMILe+1QxBoAZzxyn8KdMp3dmYdJudv7dz3J30lhwztojYi xK+TLRLUj3HXC+bR8k88Q4NA0QOBbHqdX4cvBMoQ9GS12B32XAoS1uPxzvkQaGZ6OVs1 TBsyXGVNBOBwO1fcIQsvw7d8CfuCW6RjyNBtwJ9IUG4P+WK0SUk+at+zdSgWg3CDuYls nMmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=SBfhhF06l/jwwUKZb83cdtnEc+0zywT8Baq4DfWvjWA=; b=w7hjGp9cSKdvKM2wBmF+YRtUB8Rj1AKvnUTBIhQ0FVN2RoOw/woJjfaFKxS7t4Hvvn GC6OTM/qCvvYYdu+ZYuWbyreoq9GS9ahQU5YUuYCiRt6r8MNZsTlVMenm+j8EhDkelY9 WADFDmb9nWQuuPkdGsqmbapgP7ti3nEbtPIlBI2uWV4yv+g15scleLxGti627AWkXJEE nlF1R+N0ZdaQOH2kNgeNCCm1JW/tJroiKa9iE0ii+SxEseFyQDco9/5RvIK6yH59U0tz bNwmkDr+pT+ZQXpJs9UMVhABNyKF25VtoNPUcle+WH45NjBhOIOmZK9H0JVX2y2geac8 S6gw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c13si1042057pls.209.2019.09.04.22.54.19; Wed, 04 Sep 2019 22:54:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731012AbfIEFwY (ORCPT + 99 others); Thu, 5 Sep 2019 01:52:24 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:6674 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725786AbfIEFwX (ORCPT ); Thu, 5 Sep 2019 01:52:23 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 1F1967ECF2B97A41596C; Thu, 5 Sep 2019 13:52:20 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Thu, 5 Sep 2019 13:52:10 +0800 From: zhong jiang To: , CC: , , , , , Subject: [PATCH v2] drm/amdgpu: Remove two redundant null pointer checks Date: Thu, 5 Sep 2019 13:49:12 +0800 Message-ID: <1567662552-3583-1-git-send-email-zhongjiang@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The functions "debugfs_remove" and "kfree" tolerate the passing of null pointers. Hence it is unnecessary to check such arguments around the calls. Thus remove the extra condition check at two places. Signed-off-by: zhong jiang --- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c index 5652cc7..cb94627 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c @@ -1077,8 +1077,7 @@ static int amdgpu_debugfs_ib_preempt(void *data, u64 val) ttm_bo_unlock_delayed_workqueue(&adev->mman.bdev, resched); - if (fences) - kfree(fences); + kfree(fences); return 0; } @@ -1103,8 +1102,7 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev) void amdgpu_debugfs_preempt_cleanup(struct amdgpu_device *adev) { - if (adev->debugfs_preempt) - debugfs_remove(adev->debugfs_preempt); + debugfs_remove(adev->debugfs_preempt); } #else -- 1.7.12.4