From patchwork Mon Aug 31 20:48:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 7101521 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8799FBF036 for ; Mon, 31 Aug 2015 20:48:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AEF52206A7 for ; Mon, 31 Aug 2015 20:48:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C3319206A5 for ; Mon, 31 Aug 2015 20:48:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753234AbbHaUsd (ORCPT ); Mon, 31 Aug 2015 16:48:33 -0400 Received: from mail-qk0-f169.google.com ([209.85.220.169]:34378 "EHLO mail-qk0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751631AbbHaUs1 (ORCPT ); Mon, 31 Aug 2015 16:48:27 -0400 Received: by qkct7 with SMTP id t7so16740880qkc.1 for ; Mon, 31 Aug 2015 13:48:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=avagotech.com; s=google; h=date:from:to:subject:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=WK0buDrDxSbSzfdAzmq/l4Xcyg7abo+rM7LmscTgvLk=; b=gdRuRy6ORVC8WV1P6MmlvPthbo6GOQKNqqIyKHNxnBY8jovyH52WVCjPrgEKVYnFqB GhoAV+kmODb+H5KN5rOVlqjp6USND21luTdhxV5lc6/B1Ma/1Rv8nQWoKUGlszvMJUto UwMjIuuexSoftDqwqbRX/Q1BxNQa7TntHTqSE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:user-agent :mime-version:content-type:content-transfer-encoding; bh=WK0buDrDxSbSzfdAzmq/l4Xcyg7abo+rM7LmscTgvLk=; b=eYyFOlN4TNJzki5t9Y7wV1phNlgkQFbqTbU380SzDpMZPi+5vvAYuPdmZOCOesV5Le SiiUY+a5oLaEB+k1QJZxZ/ogqRFEjzH4nj4bugoX2F+JPmUj/TM+DEvsaunaJ5zEYG/P Xw+W+9/CnfAVW4TJAMlkJS7GnNPEToawVg3W2vPFxi+V/VRr8EB/sGFqomkniO5lv5c7 vzgWQUE+esM127UDJhmYKq/DzaH1EShM76cQiqxcvGWbcJLtM5/9P1Bf0iZTQQnGY3gx 0PyFjcZWwKeIUihgzvPVZlMFZxf3SzLpelGnaE8oHt6hwwi76MK8YWPp1vn7RXV29RXe FA/w== X-Gm-Message-State: ALoCoQknooF75blTEqBX2Khg8hhZlo8IrOYCczO6oePR9tHoKu3+GiR640k/f1xMFpbcpJSSupvq X-Received: by 10.55.192.26 with SMTP id o26mr12533392qki.89.1441054106849; Mon, 31 Aug 2015 13:48:26 -0700 (PDT) Received: from myfc17 (c-75-67-235-135.hsd1.nh.comcast.net. [75.67.235.135]) by smtp.gmail.com with ESMTPSA id 197sm9429605qhc.49.2015.08.31.13.48.25 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 31 Aug 2015 13:48:25 -0700 (PDT) Date: Mon, 31 Aug 2015 16:48:11 -0400 From: james.smart@avagotech.com (James Smart) To: linux-scsi@vger.kernel.org Subject: [PATCH 04/14] lpfc: Destroy lpfc_hba_index IDR on module exit Message-ID: <55e4bd8b.S1L7J0rkKcaxN5EV%james.smart@avagotech.com> User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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 From: Johannes Thumshirn Destroy lpfc_hba_index IDR on module exit, reclaiming the allocated memory. This was detected by the following semantic patch (written by Luis Rodriguez ) @ defines_module_init @ declarer name module_init, module_exit; declarer name DEFINE_IDR; identifier init; @@ module_init(init); @ defines_module_exit @ identifier exit; @@ module_exit(exit); @ declares_idr depends on defines_module_init && defines_module_exit @ identifier idr; @@ DEFINE_IDR(idr); @ on_exit_calls_destroy depends on declares_idr && defines_module_exit @ identifier declares_idr.idr, defines_module_exit.exit; @@ exit(void) { ... idr_destroy(&idr); ... } @ missing_module_idr_destroy depends on declares_idr && defines_module_exit && !on_exit_calls_destroy @ identifier declares_idr.idr, defines_module_exit.exit; @@ exit(void) { ... +idr_destroy(&idr); } Signed-off-by: Johannes Thumshirn Signed-off-by: James Smart Reviewed-by: Hannes Reinecke --- drivers/scsi/lpfc/lpfc_init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 81bfb2d..eaf121a 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -11476,6 +11476,7 @@ lpfc_exit(void) free_pages((unsigned long)_dump_buf_dif, _dump_buf_dif_order); } kfree(lpfc_used_cpu); + idr_destroy(&lpfc_hba_index); } module_init(lpfc_init);