2015-07-08 15:23:07

by Johannes Thumshirn

[permalink] [raw]
Subject: [PATCH] IB/core: Destroy ocrdma_dev_id IDR on module exit

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

This was detected by the following semantic patch (written by Luis Rodriguez
<[email protected]>)
<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 <[email protected]>
---
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


2015-07-08 21:43:30

by Doug Ledford

[permalink] [raw]
Subject: Re: [PATCH] IB/core: Destroy ocrdma_dev_id IDR on module exit

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 <[email protected]>
GPG KeyID: 0E572FDD



Attachments:
signature.asc (884.00 B)
OpenPGP digital signature

2015-07-10 11:45:06

by Devesh Sharma

[permalink] [raw]
Subject: Re: [PATCH] IB/core: Destroy ocrdma_dev_id IDR on module exit

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

acked-by: Devesh Sharma <[email protected]>

On Thu, Jul 9, 2015 at 3:13 AM, Doug Ledford <[email protected]> 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 <[email protected]>
> GPG KeyID: 0E572FDD
>
>