Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
[linux-2.6-microblaze.git] / drivers / infiniband / core / uverbs_main.c
index a4ba0b8..4bb7c64 100644 (file)
@@ -108,8 +108,11 @@ int uverbs_dealloc_mw(struct ib_mw *mw)
        int ret;
 
        ret = mw->device->ops.dealloc_mw(mw);
-       if (!ret)
-               atomic_dec(&pd->usecnt);
+       if (ret)
+               return ret;
+
+       atomic_dec(&pd->usecnt);
+       kfree(mw);
        return ret;
 }