public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/core: Destroy ocrdma_dev_id IDR on module exit
@ 2015-07-08 15:23 Johannes Thumshirn
       [not found] ` <1436368980-31088-1-git-send-email-jthumshirn-l3A5Bk7waGM@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Thumshirn @ 2015-07-08 15:23 UTC (permalink / raw)
  To: Selvin Xavier, Devesh Sharma, Mitesh Ahuja, Doug Ledford,
	Sean Hefty, Hal Rosenstock
  Cc: linux-rdma, linux-kernel, Johannes Thumshirn

Destroy ocrdma_dev_id IDR on module exit, reclaiming the allocated memory.

This was detected by the following semantic patch (written by Luis Rodriguez
<mcgrof@suse.com>)
<SmPL>
@ 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);
 }
 
</SmPL>

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 drivers/infiniband/hw/ocrdma/ocrdma_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index 8a1398b..d98a707 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
@@ -696,6 +696,7 @@ static void __exit ocrdma_exit_module(void)
 	ocrdma_unregister_inet6addr_notifier();
 	ocrdma_unregister_inetaddr_notifier();
 	ocrdma_rem_debugfs();
+	idr_destroy(&ocrdma_dev_id);
 }
 
 module_init(ocrdma_init_module);
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] IB/core: Destroy ocrdma_dev_id IDR on module exit
       [not found] ` <1436368980-31088-1-git-send-email-jthumshirn-l3A5Bk7waGM@public.gmane.org>
@ 2015-07-08 21:43   ` Doug Ledford
       [not found]     ` <559D9975.5020306-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Doug Ledford @ 2015-07-08 21:43 UTC (permalink / raw)
  To: Johannes Thumshirn, Selvin Xavier, Devesh Sharma, Mitesh Ahuja,
	Sean Hefty, Hal Rosenstock
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 265 bytes --]

On 07/08/2015 11:23 AM, Johannes Thumshirn wrote:
> Destroy ocrdma_dev_id IDR on module exit, reclaiming the allocated memory.
>

Thanks, applied.


-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
              GPG KeyID: 0E572FDD



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] IB/core: Destroy ocrdma_dev_id IDR on module exit
       [not found]     ` <559D9975.5020306-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2015-07-10 11:44       ` Devesh Sharma
  0 siblings, 0 replies; 3+ messages in thread
From: Devesh Sharma @ 2015-07-10 11:44 UTC (permalink / raw)
  To: Doug Ledford
  Cc: Johannes Thumshirn, Selvin Xavier, Mitesh Ahuja, Sean Hefty,
	Hal Rosenstock, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

We missed to ack this patch. Thanks Dough and Johannes.

acked-by: Devesh Sharma <devesh.sharma-1wcpHE2jlwO1Z/+hSey0Gg@public.gmane.org>

On Thu, Jul 9, 2015 at 3:13 AM, Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> On 07/08/2015 11:23 AM, Johannes Thumshirn wrote:
>> Destroy ocrdma_dev_id IDR on module exit, reclaiming the allocated memory.
>>
>
> Thanks, applied.
>
>
> --
> Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>               GPG KeyID: 0E572FDD
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-10 11:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-08 15:23 [PATCH] IB/core: Destroy ocrdma_dev_id IDR on module exit Johannes Thumshirn
     [not found] ` <1436368980-31088-1-git-send-email-jthumshirn-l3A5Bk7waGM@public.gmane.org>
2015-07-08 21:43   ` Doug Ledford
     [not found]     ` <559D9975.5020306-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-07-10 11:44       ` Devesh Sharma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox