mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
arch/x86/kernel: Add missing spin_unlock
commit 84fe6c19e4 upstream.
Add a spin_unlock missing on the error path. The locks and unlocks are
balanced in other functions, so it seems that the same should be the case
here.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression E1;
@@
* spin_lock(E1,...);
<+... when != E1
if (...) {
... when != E1
* return ...;
}
...+>
* spin_unlock(E1,...);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ec883a3709
commit
2b2a3d8b7c
@@ -1420,6 +1420,7 @@ static int __attach_device(struct device *dev,
|
||||
struct protection_domain *domain)
|
||||
{
|
||||
struct iommu_dev_data *dev_data, *alias_data;
|
||||
int ret;
|
||||
|
||||
dev_data = get_dev_data(dev);
|
||||
alias_data = get_dev_data(dev_data->alias);
|
||||
@@ -1431,13 +1432,14 @@ static int __attach_device(struct device *dev,
|
||||
spin_lock(&domain->lock);
|
||||
|
||||
/* Some sanity checks */
|
||||
ret = -EBUSY;
|
||||
if (alias_data->domain != NULL &&
|
||||
alias_data->domain != domain)
|
||||
return -EBUSY;
|
||||
goto out_unlock;
|
||||
|
||||
if (dev_data->domain != NULL &&
|
||||
dev_data->domain != domain)
|
||||
return -EBUSY;
|
||||
goto out_unlock;
|
||||
|
||||
/* Do real assignment */
|
||||
if (dev_data->alias != dev) {
|
||||
@@ -1453,10 +1455,14 @@ static int __attach_device(struct device *dev,
|
||||
|
||||
atomic_inc(&dev_data->bind);
|
||||
|
||||
ret = 0;
|
||||
|
||||
out_unlock:
|
||||
|
||||
/* ready */
|
||||
spin_unlock(&domain->lock);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user