Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58d876fa authored by Dan Carpenter's avatar Dan Carpenter Committed by Michael Ellerman
Browse files

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarFrederic Barrat <fbarrat@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 4386c096
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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 @@ static int device_open(struct inode *inode, struct file *file)
		free_page((unsigned long) le);
err:
	put_device(&adapter->dev);
err_unlock:
	up(&sem);

	return rc;
}