Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2210870ybb; Sun, 5 Apr 2020 01:37:33 -0700 (PDT) X-Google-Smtp-Source: APiQypJ9Qpa/Zrtv/wmT8A/HVZiB10u6FEUd8uqeZExv18SPd+duLbAwc3HC9gZGBZWGghk18C4l X-Received: by 2002:a4a:ba0b:: with SMTP id b11mr13271758oop.92.1586075852877; Sun, 05 Apr 2020 01:37:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586075852; cv=none; d=google.com; s=arc-20160816; b=gCT4WQQQOb/CRjUZ2LQZ2VEnR/q3TCLwGZNJfEKYOO4yyRakZsd/30N0i6m+crKeuI 3cULouRxAHBATXxMh52HHyo9nn2jLVvu2282itcCtJhQzdNylQdJWCbCA/XK9kg3sfNa XIxXkPwJX60lanjG378z/QZUSL9vzmCS+sEvKhE0Zsrsdbmrq4CB/b2scGoaPT3UguQ6 TEmk9Q8bCJagIHF1scYg3zxVHzzmNGm/95WtEGXToTRswL/DwnYAx3eMIHsOTkPMvZ2H q2NCHAfWlKJALLnY0WtXiHnd+d8M+oBSMCOur6DiI5ThySQKdlFgDlfSf81ZdEM2EXuD rrcg== 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 :dkim-signature; bh=Ncl8XXtzp8goItvEp2ww15C1VisVJr6bKa4zYnBNmX0=; b=PC9ZoGApS2S6WtF/DxgJf1oQO5PRMCLg1l0PBBn7e0W3Zd7kwuZjaOsoz6eLN4psI1 CuRc8V4HHg/eKRLKNZ1wTU+eICnhIbR89h593Y+BCHciMrG1HrUCFYMKAZscZQg/p+O5 toUf+VXpZGx6ZssS+VbB8yVjoAoIvZlEhXSjJDISy+0bFyf7lYasZjpmWE+YrV8ygGe6 3MQhdkEtQ8ASD+OcM/fhzNmR/XMLdZI6yDwkhpt2tGEBMVbnX/y37OVe/Y+vDixleI4C lhdJ5+Z9/k+7FTQ9fEKytU6Z3u9HAb4r30g8n0a+Zd61a6Sz6WC3N7D8eGw79a8ycAoF kFcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UiBbl3Jg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t2si5927781oih.136.2020.04.05.01.37.19; Sun, 05 Apr 2020 01:37:32 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UiBbl3Jg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726426AbgDEIhA (ORCPT + 99 others); Sun, 5 Apr 2020 04:37:00 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:34881 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726308AbgDEIhA (ORCPT ); Sun, 5 Apr 2020 04:37:00 -0400 Received: by mail-pf1-f193.google.com with SMTP id a13so6007474pfa.2; Sun, 05 Apr 2020 01:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Ncl8XXtzp8goItvEp2ww15C1VisVJr6bKa4zYnBNmX0=; b=UiBbl3JgXB+WXPn0PDlm6JGE4zUA0Lk+w2SyBVnGyw+dtI3fMZAwpQvxLQLp1zocmc cbZAjRELnDckLbIDej8cQ9TYieSow+wb5wXbORwlZevebns6eo8/z0JWd8gu9J6eQvcw hazEBqpkdC/xBC+YGvNdp/RryMhQ/PVr5bSPI/hnLNMKTMSs9uJrrKbom6qKwt53EDl6 DcRcqE9SMUU8sMl3p5awrJZf2xuCdUStIN8IFN3vUpYauz/B1Me3zUaDSTYiU1K/RbSb fzUtxc7jlXr99CrDzjo6H1+wCRql+6stLwwjt9iiefUmyJqE7D+H6jnjoPQcAsxrXOVl ZGFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Ncl8XXtzp8goItvEp2ww15C1VisVJr6bKa4zYnBNmX0=; b=IVIxM5N2nZf2mFqVHJknxklv6Tozfk8SMDwcv9j956+LEdk+pKN7R3QArlfYX6WWvg Hk0R2ouoazFK1irysfp3DtVp8nF3r0m6Rx+MqAsq+qWxGo1R9Qp9OsEfvK5pV49vUdXQ H8s+7o1gJmwji70hX4O6cM1qrrFtveq6YAaIaCITm6t0Ah80kLiqohz8hGcCT9nLeEG6 kJeZhhmMnEbzcrejqXtHfpiD7cyQG5ieBHzO1tnAcJKgScDgfvYF1fcCGFJZGznowZCN a/0yUSIXgsyvaElOOrbln2fSu5eXDkHTkYbV5CU5KuL5iajctvrJre1oQ6YaHuGcmR69 0aPg== X-Gm-Message-State: AGi0Pubx71WSMvGnvlOUz0g1uNenb3YTfEEyjkoi0x2LLW65VR0tjzwj Vb6pdicLoN57msxlyAfC2OM= X-Received: by 2002:a63:602:: with SMTP id 2mr15774896pgg.356.1586075818769; Sun, 05 Apr 2020 01:36:58 -0700 (PDT) Received: from localhost (n112120135125.netvigator.com. [112.120.135.125]) by smtp.gmail.com with ESMTPSA id y3sm8991405pfy.158.2020.04.05.01.36.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 05 Apr 2020 01:36:58 -0700 (PDT) From: Qiujun Huang To: jdike@addtoit.com, richard@nod.at, anton.ivanov@cambridgegreys.com Cc: ast@kernel.org, daniel@iogearbox.net, linux-um@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Qiujun Huang Subject: [PATCH] um: delete an unnecessary check before the kfree Date: Sun, 5 Apr 2020 16:36:52 +0800 Message-Id: <20200405083652.29462-1-hqjagain@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org NULL check before kfree is unnecessary so remove it. This issue was detected by using the Coccinelle software. Signed-off-by: Qiujun Huang --- arch/um/drivers/vector_user.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/arch/um/drivers/vector_user.c b/arch/um/drivers/vector_user.c index ddcd917be0af..aa28e9eecb7b 100644 --- a/arch/um/drivers/vector_user.c +++ b/arch/um/drivers/vector_user.c @@ -221,8 +221,7 @@ static struct vector_fds *user_init_tap_fds(struct arglist *ifspec) return result; tap_cleanup: printk(UM_KERN_ERR "user_init_tap: init failed, error %d", fd); - if (result != NULL) - kfree(result); + kfree(result); return NULL; } @@ -266,8 +265,7 @@ static struct vector_fds *user_init_hybrid_fds(struct arglist *ifspec) return result; hybrid_cleanup: printk(UM_KERN_ERR "user_init_hybrid: init failed"); - if (result != NULL) - kfree(result); + kfree(result); return NULL; } @@ -344,10 +342,8 @@ static struct vector_fds *user_init_unix_fds(struct arglist *ifspec, int id) unix_cleanup: if (fd >= 0) os_close_file(fd); - if (remote_addr != NULL) - kfree(remote_addr); - if (result != NULL) - kfree(result); + kfree(remote_addr); + kfree(result); return NULL; } @@ -382,8 +378,7 @@ static struct vector_fds *user_init_raw_fds(struct arglist *ifspec) return result; raw_cleanup: printk(UM_KERN_ERR "user_init_raw: init failed, error %d", err); - if (result != NULL) - kfree(result); + kfree(result); return NULL; } -- 2.17.1