summaryrefslogtreecommitdiff
path: root/drivers/misc/cxl/flash.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-05-05 08:34:58 +0300
committerMichael Ellerman <mpe@ellerman.id.au>2017-06-06 19:23:52 +1000
commit58d876fa7181f2f393190c1d32c056b5a9d34aa2 (patch)
tree1615df4830fdfbf5c35a31bb8447ba0f3387ecfd /drivers/misc/cxl/flash.c
parent4386c096c2ffa1b3232d701e9d7ff82a1378e1c5 (diff)
cxl: Unlock on error in probe
We should unlock if get_cxl_adapter() fails. Fixes: 594ff7d067ca ("cxl: Support to flash a new image on the adapter from a guest") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'drivers/misc/cxl/flash.c')
-rw-r--r--drivers/misc/cxl/flash.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/misc/cxl/flash.c b/drivers/misc/cxl/flash.c
index 7c61c70ba3f6..3aa216bf0939 100644
--- a/drivers/misc/cxl/flash.c
+++ b/drivers/misc/cxl/flash.c
@@ -401,8 +401,10 @@ static int device_open(struct inode *inode, struct file *file)
if (down_interruptible(&sem) != 0)
return -EPERM;
- if (!(adapter = get_cxl_adapter(adapter_num)))
- return -ENODEV;
+ if (!(adapter = get_cxl_adapter(adapter_num))) {
+ rc = -ENODEV;
+ goto err_unlock;
+ }
file->private_data = adapter;
continue_token = 0;
@@ -446,6 +448,8 @@ err1:
free_page((unsigned long) le);
err:
put_device(&adapter->dev);
+err_unlock:
+ up(&sem);
return rc;
}