diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-10-23 04:57:50 (GMT) |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-10-23 04:57:50 (GMT) |
commit | 274035751e25ee15a064e43cde7b4e7a9b75d921 (patch) | |
tree | bf5f3f18f14855043324ef02a116532d866e3dac /drivers/misc/cxl/file.c | |
parent | 53e597b1d194910bef53ed0632da329fef497904 (diff) | |
parent | a5be88f63eaff1c03774aecd7388015cb87f6b2c (diff) | |
download | linux-274035751e25ee15a064e43cde7b4e7a9b75d921.tar.xz |
Merge branch 'topic/hw-constraint-single' into for-next
Diffstat (limited to 'drivers/misc/cxl/file.c')
-rw-r--r-- | drivers/misc/cxl/file.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/misc/cxl/file.c b/drivers/misc/cxl/file.c index a30bf28..7ccd299 100644 --- a/drivers/misc/cxl/file.c +++ b/drivers/misc/cxl/file.c @@ -120,9 +120,16 @@ int afu_release(struct inode *inode, struct file *file) __func__, ctx->pe); cxl_context_detach(ctx); - mutex_lock(&ctx->mapping_lock); - ctx->mapping = NULL; - mutex_unlock(&ctx->mapping_lock); + + /* + * Delete the context's mapping pointer, unless it's created by the + * kernel API, in which case leave it so it can be freed by reclaim_ctx() + */ + if (!ctx->kernelapi) { + mutex_lock(&ctx->mapping_lock); + ctx->mapping = NULL; + mutex_unlock(&ctx->mapping_lock); + } put_device(&ctx->afu->dev); |