diff options
author | Martyn Welch <martyn.welch@gefanuc.com> | 2009-10-29 12:35:08 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-11 15:23:18 -0500 |
commit | 8be9226c8f686c6dd2bae0a7ed4f5795e89d32d8 (patch) | |
tree | 6d771abef2e3082b50d2e0bd17fba8c644870cce /drivers | |
parent | 59c2290428dd93a4117aa453fc4c2be38da288c0 (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')
-rw-r--r-- | drivers/staging/vme/vme.c | 14 |
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, | |||
1191 | 1191 | ||
1192 | /* XXX Check parameters */ | 1192 | /* XXX Check parameters */ |
1193 | 1193 | ||
1194 | return lm->parent->lm_set(lm, lm_base, aspace, cycle); | 1194 | return bridge->lm_set(lm, lm_base, aspace, cycle); |
1195 | } | 1195 | } |
1196 | EXPORT_SYMBOL(vme_lm_set); | 1196 | EXPORT_SYMBOL(vme_lm_set); |
1197 | 1197 | ||
@@ -1271,16 +1271,18 @@ void vme_lm_free(struct vme_resource *resource) | |||
1271 | 1271 | ||
1272 | lm = list_entry(resource->entry, struct vme_lm_resource, list); | 1272 | lm = list_entry(resource->entry, struct vme_lm_resource, list); |
1273 | 1273 | ||
1274 | if (mutex_trylock(&(lm->mtx))) { | 1274 | mutex_lock(&(lm->mtx)); |
1275 | printk(KERN_ERR "Resource busy, can't free\n"); | ||
1276 | return; | ||
1277 | } | ||
1278 | 1275 | ||
1279 | /* XXX Check to see that there aren't any callbacks still attached */ | 1276 | /* XXX |
1277 | * Check to see that there aren't any callbacks still attached, if | ||
1278 | * there are we should probably be detaching them! | ||
1279 | */ | ||
1280 | 1280 | ||
1281 | lm->locked = 0; | 1281 | lm->locked = 0; |
1282 | 1282 | ||
1283 | mutex_unlock(&(lm->mtx)); | 1283 | mutex_unlock(&(lm->mtx)); |
1284 | |||
1285 | kfree(resource); | ||
1284 | } | 1286 | } |
1285 | EXPORT_SYMBOL(vme_lm_free); | 1287 | EXPORT_SYMBOL(vme_lm_free); |
1286 | 1288 | ||