From patchwork Mon Dec 12 18:15:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Shishkin X-Patchwork-Id: 9471005 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 75C0960476 for ; Mon, 12 Dec 2016 18:18:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6468F27F85 for ; Mon, 12 Dec 2016 18:18:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 583CC284E7; Mon, 12 Dec 2016 18:18:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC27127F85 for ; Mon, 12 Dec 2016 18:18:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752088AbcLLSSW (ORCPT ); Mon, 12 Dec 2016 13:18:22 -0500 Received: from mail-wj0-f194.google.com ([209.85.210.194]:35966 "EHLO mail-wj0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751792AbcLLSSW (ORCPT ); Mon, 12 Dec 2016 13:18:22 -0500 Received: by mail-wj0-f194.google.com with SMTP id j10so12956840wjb.3 for ; Mon, 12 Dec 2016 10:18:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wyUs8Bd4SKzHe0pFo3yYjReyBbS1lpF0SNcez02exzU=; b=R9+fN0tnH7KPbi6jmc5G4XAfGoPGEwtAjyp0278zLnWk6HIa2kTC3/aaW7jssP3DGu Eba68PPIwo6d2W6LZ3dHig9yP0g/7DWk9uAmANtF2uos86zgXseeUweK5NFOwqvLZGR3 uv4wleAdM1JYcQPbkzLrnt/mMT5StyF8gdfc2XuRC510TDJfQRYnhhLS+/B2ijmyj3Ma OhE08ArD+hwqmYnWqsqZ5Zwo3RPE/tBtyRsnRfWmSFWc9J7L9Kra1cRxJwONSlfhbPul vqSBO+HoYKBhT4olE/N/qUfdoNteMkcmEPCL30IHSq/QljtbiI9ud6L3aSfA0x9viLZV C2aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wyUs8Bd4SKzHe0pFo3yYjReyBbS1lpF0SNcez02exzU=; b=N6E0anYNFu5DO/y/spNOzMhrwZNh7C5jqSHStLyxtNCqqWoVT6OYZ6khGxDweDCsBL nywvEBsIDhg0SgtLqA5HU1reX5XZe6Un4bDh+vYqtXaMpfQYduVjG9K45viLrqizA3jE l2VaPURzCSzgOBc2jP5n1jhtSwDV5M9beBJT1Khovg/a96LvjXPxEk2bdb8ezhmpqhQV cf/6TuYhbdufO1lYy7FYAsGjwNcHG0qPiJ4tg/TfBJXbvKPP9ILjEvnXGC08wrEp5tng 9Gqq692+uslPU3i+85Rzv6zdSBIp2kpSJQSrTmok9Yc4gObiqRlrah0ZWlfofGJ3rxpL 1Dwg== X-Gm-Message-State: AKaTC01diH4yy1DWuaay7XylOrftXeSq3svzUi35gp3a6Wu5+ayroHMN8b3YQ97uj8xUBA== X-Received: by 10.194.52.42 with SMTP id q10mr78732519wjo.50.1481566700649; Mon, 12 Dec 2016 10:18:20 -0800 (PST) Received: from zeta.huawei.com (h-213.61.75.66.host.de.colt.net. [213.61.75.66]) by smtp.gmail.com with ESMTPSA id kp5sm58432667wjb.8.2016.12.12.10.18.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Dec 2016 10:18:20 -0800 (PST) From: edward.shishkin@gmail.com To: Eric Van Hensbergen , V9FS Developers Mailing List , Linux Filesystem Development List Cc: QEMU Developers Mailing List , ZhangWei , Claudio Fontana , Greg Kurz , Alexander Graf , kbuild test robot , Eduard Shishkin Subject: [PATCH 3/7] 9p: v9fs fix ifnullfree.cocci warnings Date: Mon, 12 Dec 2016 19:15:38 +0100 Message-Id: <1481566542-25894-3-git-send-email-edward.shishkin@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481566542-25894-1-git-send-email-edward.shishkin@gmail.com> References: <1481566542-25894-1-git-send-email-edward.shishkin@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: kbuild test robot fs/9p/v9fs.c:318:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values. fs/9p/v9fs.c:320:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values. NULL check before some freeing functions is not needed. Based on checkpatch warning "kfree(NULL) is safe this check is probably not required" and kfreeaddr.cocci by Julia Lawall. Generated by: scripts/coccinelle/free/ifnullfree.cocci Signed-off-by: Fengguang Wu Signed-off-by: Eduard Shishkin --- fs/9p/v9fs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 3b49daf..e2f84a6 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c @@ -314,10 +314,8 @@ void put_flush_set(struct v9fs_flush_set *fset) { if (!fset) return; - if (fset->pages) - kfree(fset->pages); - if (fset->buf) - kfree(fset->buf); + kfree(fset->pages); + kfree(fset->buf); kfree(fset); }