提交 58d876fa 编写于 作者: D Dan Carpenter 提交者: Michael Ellerman

cxl: Unlock on error in probe

We should unlock if get_cxl_adapter() fails.

Fixes: 594ff7d0 ("cxl: Support to flash a new image on the adapter from a guest")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Acked-by: NFrederic Barrat <fbarrat@linux.vnet.ibm.com>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 4386c096
...@@ -401,8 +401,10 @@ static int device_open(struct inode *inode, struct file *file) ...@@ -401,8 +401,10 @@ static int device_open(struct inode *inode, struct file *file)
if (down_interruptible(&sem) != 0) if (down_interruptible(&sem) != 0)
return -EPERM; return -EPERM;
if (!(adapter = get_cxl_adapter(adapter_num))) if (!(adapter = get_cxl_adapter(adapter_num))) {
return -ENODEV; rc = -ENODEV;
goto err_unlock;
}
file->private_data = adapter; file->private_data = adapter;
continue_token = 0; continue_token = 0;
...@@ -446,6 +448,8 @@ static int device_open(struct inode *inode, struct file *file) ...@@ -446,6 +448,8 @@ static int device_open(struct inode *inode, struct file *file)
free_page((unsigned long) le); free_page((unsigned long) le);
err: err:
put_device(&adapter->dev); put_device(&adapter->dev);
err_unlock:
up(&sem);
return rc; return rc;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册