From patchwork Tue Jan 27 21:35:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fengguang Wu X-Patchwork-Id: 5720731 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 29D0F9F358 for ; Tue, 27 Jan 2015 21:36:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 714B620256 for ; Tue, 27 Jan 2015 21:36:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9A2BA2011D for ; Tue, 27 Jan 2015 21:36:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759828AbbA0Vgf (ORCPT ); Tue, 27 Jan 2015 16:36:35 -0500 Received: from mga03.intel.com ([134.134.136.65]:19773 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759473AbbA0Vge (ORCPT ); Tue, 27 Jan 2015 16:36:34 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 27 Jan 2015 13:32:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,476,1418112000"; d="scan'208";a="668607372" Received: from bee.sh.intel.com (HELO bee) ([10.239.97.14]) by fmsmga002.fm.intel.com with ESMTP; 27 Jan 2015 13:36:31 -0800 Received: from kbuild by bee with local (Exim 4.83) (envelope-from ) id 1YGDoE-000NLm-EE; Wed, 28 Jan 2015 05:36:30 +0800 Date: Wed, 28 Jan 2015 05:35:56 +0800 From: kbuild test robot To: Ira Weiny Cc: kbuild-all@01.org, Roland Dreier , Sean Hefty , Hal Rosenstock , Or Gerlitz , Yan Burman , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] IB/mad: fix ifnullfree.cocci warnings Message-ID: <20150127213555.GA14218@waimea> References: <201501280547.wGzvHfd3%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <201501280547.wGzvHfd3%fengguang.wu@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: fengguang.wu@intel.com X-SA-Exim-Scanned: No (on bee); SAEximRunCond expanded to false Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP drivers/infiniband/core/mad.c:2088:3-8: 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: Ira Weiny Reviewed-by: Ira Weiny Tested-by: Ira Weiny --- mad.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -2084,8 +2084,7 @@ out: /* Post another receive request for this QP */ if (response) { ib_mad_post_receive_mads(qp_info, response); - if (recv) - kfree(recv); + kfree(recv); } else ib_mad_post_receive_mads(qp_info, recv); }