Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1007726ybh; Wed, 22 Jul 2020 20:18:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaIHEte/7J8PEK7Hepip6pAo/+4WK4g+yaofDmxicWAenDLE2wPiNVeGzeYkgYCNkyO/2m X-Received: by 2002:a17:906:94c4:: with SMTP id d4mr2420216ejy.232.1595474319642; Wed, 22 Jul 2020 20:18:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595474319; cv=none; d=google.com; s=arc-20160816; b=eng5KNeMGHpN0YtaAVqeDdUSqi8eSoKHqYIlSAx4+8WPS9q4z/6PNH2uQ/1G3dNCTa Mt1AwHA5jNRreIoYvxz54RP5BPT4yHQXVBa+b8fj2TCCXbqUjQR2eci5mwJsHVzcCi1U JBn6+W2OT1vtM5hqLR/HHtDLkKc4X2pIPyrD5ybLJwaWk8GAMmotrSBdI9SyovX6kWD3 u8VLJpCljbZYLqhPpv9LKXJCohgWYmzy0C2CapybtbBtiMsOwTc3l9m6XIwRSVpm63ZX 1dm+8tYwp/+MR1QsjHW3Ux3WnJo8s8gDUAgStYewpCBIQcWCjNlw3ouNmwqFiDcwtRZT KvPw== 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=5dqjPVjmAzKfkoNp1c36xaSk/bC5Tpr2B3jqBkNNCfY=; b=vYcmc+jYwDIvtZtasVRiv8uK4S164wxqKBh82bpht+9O03Na4j1Nzehiewgl98sSgn xuzvErCsUx0Dtu4WOdr5yb57qE3Z4FhX7K2yIHokj/JG4L+suETIJljVDLJ66cWaIZzE RUxTuZxt3iLMuTnE+CgmRW+Mj3BRo4qeck3nJFBe/MBHhT8gzAXUXU5ET88oyFE5eBYf 1aEASizNVybuKM2GHncxkiMMXocn0wmHRyg7NqW7E7C2eL4XngrG5GySP+JToECDRw1x y5F3GXNcwnhl/ePignvCG63qSsWJN3FcMeU1qijitzA+Z/K9IY2ClPa1UuwXEgKJ6M0n K0ew== 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 n7si145842ejl.448.2020.07.22.20.18.17; Wed, 22 Jul 2020 20:18:39 -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 S2387497AbgGWDRp (ORCPT + 99 others); Wed, 22 Jul 2020 23:17:45 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8254 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728902AbgGWDRo (ORCPT ); Wed, 22 Jul 2020 23:17:44 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id F226415FB4F193D458E8; Thu, 23 Jul 2020 11:17:40 +0800 (CST) Received: from huawei.com (10.175.104.57) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.487.0; Thu, 23 Jul 2020 11:17:37 +0800 From: Li Heng To: , CC: , , Subject: [PATCH -next] io_uring: Remove redundant NULL check Date: Thu, 23 Jul 2020 11:19:10 +0800 Message-ID: <1595474350-10039-1-git-send-email-liheng40@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.104.57] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix below warnings reported by coccicheck: ./fs/io_uring.c:1544:2-7: WARNING: NULL check before some freeing functions is not needed. ./fs/io_uring.c:3095:2-7: WARNING: NULL check before some freeing functions is not needed. ./fs/io_uring.c:3195:2-7: WARNING: NULL check before some freeing functions is not needed. Signed-off-by: Li Heng --- fs/io_uring.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 6587935..71ac3f7 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1540,8 +1540,7 @@ static void io_dismantle_req(struct io_kiocb *req) { io_clean_op(req); - if (req->io) - kfree(req->io); + kfree(req->io); if (req->file) io_put_file(req, req->file, (req->flags & REQ_F_FIXED_FILE)); io_req_clean_work(req); @@ -3091,8 +3090,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock, } } out_free: - if (iovec) - kfree(iovec); + kfree(iovec); return ret; } @@ -3191,8 +3189,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock, } } out_free: - if (iovec) - kfree(iovec); + kfree(iovec); return ret; } -- 2.7.4