summaryrefslogtreecommitdiff
path: root/drivers/staging/vme
diff options
context:
space:
mode:
authorMartyn Welch <martyn.welch@gefanuc.com>2009-10-29 16:35:08 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-11 12:23:18 -0800
commit8be9226c8f686c6dd2bae0a7ed4f5795e89d32d8 (patch)
tree6d771abef2e3082b50d2e0bd17fba8c644870cce /drivers/staging/vme
parent59c2290428dd93a4117aa453fc4c2be38da288c0 (diff)
Staging: vme: Correct operation of vme_lm_free
The vme_lm_free() function is not clearing up the resource created in vme_lm_request(). In addition vme_lm_free() is void function and is used in exit/error paths, we should wait for mutex to become free rather than exiting and not freeing the resource. Signed-off-by: Martyn Welch <martyn.welch@gefanuc.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/vme')
-rw-r--r--drivers/staging/vme/vme.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c
index 241929f99265..a6154f96b826 100644
--- a/drivers/staging/vme/vme.c
+++ b/drivers/staging/vme/vme.c
@@ -1191,7 +1191,7 @@ int vme_lm_set(struct vme_resource *resource, unsigned long long lm_base,
/* XXX Check parameters */
- return lm->parent->lm_set(lm, lm_base, aspace, cycle);
+ return bridge->lm_set(lm, lm_base, aspace, cycle);
}
EXPORT_SYMBOL(vme_lm_set);
@@ -1271,16 +1271,18 @@ void vme_lm_free(struct vme_resource *resource)
lm = list_entry(resource->entry, struct vme_lm_resource, list);
- if (mutex_trylock(&(lm->mtx))) {
- printk(KERN_ERR "Resource busy, can't free\n");
- return;
- }
+ mutex_lock(&(lm->mtx));
- /* XXX Check to see that there aren't any callbacks still attached */
+ /* XXX
+ * Check to see that there aren't any callbacks still attached, if
+ * there are we should probably be detaching them!
+ */
lm->locked = 0;
mutex_unlock(&(lm->mtx));
+
+ kfree(resource);
}
EXPORT_SYMBOL(vme_lm_free);