diff mbox

IB/core: Destroy ocrdma_dev_id IDR on module exit

Message ID 1436368980-31088-1-git-send-email-jthumshirn@suse.de (mailing list archive)
State Accepted
Headers show

Commit Message

Johannes Thumshirn July 8, 2015, 3:23 p.m. UTC
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(+)

Comments

Doug Ledford July 8, 2015, 9:43 p.m. UTC | #1
On 07/08/2015 11:23 AM, Johannes Thumshirn wrote:
> Destroy ocrdma_dev_id IDR on module exit, reclaiming the allocated memory.
>

Thanks, applied.
Devesh Sharma July 10, 2015, 11:44 a.m. UTC | #2
We missed to ack this patch. Thanks Dough and Johannes.

acked-by: Devesh Sharma <devesh.sharma@avagotech.com>

On Thu, Jul 9, 2015 at 3:13 AM, Doug Ledford <dledford@redhat.com> 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@redhat.com>
>               GPG KeyID: 0E572FDD
>
>
--
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
diff mbox

Patch

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);