From patchwork Wed Mar 23 02:38:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kernel test robot X-Patchwork-Id: 8646881 Return-Path: X-Original-To: patchwork-linux-scsi@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 2F2ED9FCAA for ; Wed, 23 Mar 2016 02:39:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7164E20397 for ; Wed, 23 Mar 2016 02:39:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8601A2038A for ; Wed, 23 Mar 2016 02:39:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753912AbcCWCjg (ORCPT ); Tue, 22 Mar 2016 22:39:36 -0400 Received: from mga09.intel.com ([134.134.136.24]:36193 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753568AbcCWCjd (ORCPT ); Tue, 22 Mar 2016 22:39:33 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 22 Mar 2016 19:39:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,380,1455004800"; d="scan'208";a="939629751" Received: from bee.sh.intel.com (HELO bee) ([10.239.97.14]) by orsmga002.jf.intel.com with ESMTP; 22 Mar 2016 19:39:31 -0700 Received: from kbuild by bee with local (Exim 4.83) (envelope-from ) id 1aiYhk-000HFO-NX; Wed, 23 Mar 2016 10:39:28 +0800 Date: Wed, 23 Mar 2016 10:38:12 +0800 From: kbuild test robot To: Ming Lin Cc: kbuild-all@01.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, Christoph Hellwig Subject: [PATCH] lib: scatterlist: fix ifnullfree.cocci warnings Message-ID: <20160323023812.GA163037@athens> References: <201603231036.A8dUuAli%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1458684196-15923-6-git-send-email-mlin@kernel.org> 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-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@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 lib/sg_pool.c:152:3-18: 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. lib/sg_pool.c:154:3-21: 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 CC: Ming Lin Signed-off-by: Fengguang Wu --- sg_pool.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/lib/sg_pool.c +++ b/lib/sg_pool.c @@ -148,10 +148,8 @@ static __init int sg_pool_init(void) cleanup_sdb: for (i = 0; i < SG_MEMPOOL_NR; i++) { struct sg_pool *sgp = sg_pools + i; - if (sgp->pool) - mempool_destroy(sgp->pool); - if (sgp->slab) - kmem_cache_destroy(sgp->slab); + mempool_destroy(sgp->pool); + kmem_cache_destroy(sgp->slab); } return -ENOMEM;