Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3588131ybz; Mon, 20 Apr 2020 05:53:17 -0700 (PDT) X-Google-Smtp-Source: APiQypLzzPs5bPCB7j8DmocDl6Ownpo3yAo+Wvp0dfYwJuYvVFn8P3aVolGypKazNAG8XLpmWNLq X-Received: by 2002:a17:906:d20e:: with SMTP id w14mr15567772ejz.19.1587387196883; Mon, 20 Apr 2020 05:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587387196; cv=none; d=google.com; s=arc-20160816; b=rMcAt3ZKUWstMWDNJ+hJTcvRm9ioxBebHnwFPTBMD+C5FNN9HQViihXAwAroK+Ha7o Sbq7Sn9mOvDhzI2TOunzohJwCS0qfjeoUqvZfZ/ZbDYpRPU07oxmA0X+0eMbvx+hBOEI C9wJGUdxuNGzorPdw2w4Uxl4LA+vOesTgWXtjcySACu3oPqnI6Ff56t+cgBVCAzNCdZM re2MVqhtihF9CSSFG2C4flZAaEsFFBL7SG8ORYBfJmJbOdnVr/EthGglIerDIrTM9knC iGORDTAMvbZwoW3bxBBvFkmpgJNmI4/yJw3GEgjFwFBZqt66hBjP0M6Cd6R4CwILO0Sn aNUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=u2yt9BxF3Q1dv528QXC+QyQN+odSl/zX1gCPspLd4QU=; b=gYjU02Is+IkNuN4Z9Esw2t7rc3o3p2ptu+7lpMJxyykTMpwH0t9zkDUf5twcMoMTHU F2jJdGLfZP23A9GkP9UO/6Soy1c4nYiTZSyGRkm/5GKp0IKmkIK/abKE/EcWvKZTmAYh LGw6jaeYyDsrXZ60Xjisu6VPBWhNG8RPhlQkwukPIPOxjvsvkRJyYKYjQ5zwdw6ESEDQ m2iMzl5IaNAYp3Jgmh4PSvHtQGrtG+VODvMHcldQcafcepigjWuHgupmfk04YWvIwZ5T SZz1ZsFR+xRQzuwBKhLh930i2QWhfgbdepem3CU3b9g4cdbxLp8BwcXZvsCn2rBkPrMn T4cA== 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 bq5si462929ejb.356.2020.04.20.05.52.53; Mon, 20 Apr 2020 05:53:16 -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 S1728797AbgDTMu6 (ORCPT + 99 others); Mon, 20 Apr 2020 08:50:58 -0400 Received: from m176115.mail.qiye.163.com ([59.111.176.115]:5751 "EHLO m176115.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726835AbgDTMuv (ORCPT ); Mon, 20 Apr 2020 08:50:51 -0400 Received: from ubuntu.localdomain (unknown [157.0.31.122]) by m176115.mail.qiye.163.com (Hmail) with ESMTPA id 1AD916647F5; Mon, 20 Apr 2020 20:50:48 +0800 (CST) From: Bernard Zhao To: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "David (ChunMing) Zhou" , David Airlie , Daniel Vetter , Felix Kuehling , Philip Yang , Nirmoy Das , =?UTF-8?q?Nicolai=20H=C3=A4hnle?= , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Bernard Zhao Subject: [PATCH V2] amdgpu, fix unnessary check "info" NULL branch Date: Mon, 20 Apr 2020 05:50:37 -0700 Message-Id: <1587387039-120881-1-git-send-email-bernard@vivo.com> X-Mailer: git-send-email 2.7.4 X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZT1VJTk5LS0tKSk9PT0tCSVlXWShZQU hPN1dZLVlBSVdZCQ4XHghZQVk1NCk2OjckKS43PlkG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Pxw6MBw5FDg6SwweCRc3CwxK NT4aFE9VSlVKTkNMSENMS09DT0hNVTMWGhIXVRkeCRUaCR87DRINFFUYFBZFWVdZEgtZQVlKTkxV S1VISlVKSUlZV1kIAVlBSUhKSDcG X-HM-Tid: 0a7197a421a29373kuws1ad916647f5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kvfree ensure that the null pointer will do nothing. If addr is NULL, first is_vmalloc_addr will not enter, and kfree function just return when addr is NULL. There will be no risk here. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index af91627b..814bd5d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -98,8 +98,7 @@ static int amdgpu_cs_bo_handles_chunk(struct amdgpu_cs_parser *p, return 0; error_free: - if (info) - kvfree(info); + kvfree(info); return r; } -- 2.7.4