diff options
author | Julia Lawall <julia@diku.dk> | 2010-05-27 06:31:51 -0400 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2010-05-27 06:40:11 -0400 |
commit | 84fe6c19e4a598e8071e3bd1b2c923454eae1268 (patch) | |
tree | 97acb87b00cc194665caf8cc5920cd7e7858bac1 | |
parent | 795e74f7a69f9c08afa4fa7c86cc4f18a62bd630 (diff) |
arch/x86/kernel: Add missing spin_unlock
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>
Cc: stable@kernel.org
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
-rw-r--r-- | arch/x86/kernel/amd_iommu.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index fa5a1474cd18..8a9aaa8412c9 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
@@ -1487,6 +1487,7 @@ static int __attach_device(struct device *dev, | |||
1487 | struct protection_domain *domain) | 1487 | struct protection_domain *domain) |
1488 | { | 1488 | { |
1489 | struct iommu_dev_data *dev_data, *alias_data; | 1489 | struct iommu_dev_data *dev_data, *alias_data; |
1490 | int ret; | ||
1490 | 1491 | ||
1491 | dev_data = get_dev_data(dev); | 1492 | dev_data = get_dev_data(dev); |
1492 | alias_data = get_dev_data(dev_data->alias); | 1493 | alias_data = get_dev_data(dev_data->alias); |
@@ -1498,13 +1499,14 @@ static int __attach_device(struct device *dev, | |||
1498 | spin_lock(&domain->lock); | 1499 | spin_lock(&domain->lock); |
1499 | 1500 | ||
1500 | /* Some sanity checks */ | 1501 | /* Some sanity checks */ |
1502 | ret = -EBUSY; | ||
1501 | if (alias_data->domain != NULL && | 1503 | if (alias_data->domain != NULL && |
1502 | alias_data->domain != domain) | 1504 | alias_data->domain != domain) |
1503 | return -EBUSY; | 1505 | goto out_unlock; |
1504 | 1506 | ||
1505 | if (dev_data->domain != NULL && | 1507 | if (dev_data->domain != NULL && |
1506 | dev_data->domain != domain) | 1508 | dev_data->domain != domain) |
1507 | return -EBUSY; | 1509 | goto out_unlock; |
1508 | 1510 | ||
1509 | /* Do real assignment */ | 1511 | /* Do real assignment */ |
1510 | if (dev_data->alias != dev) { | 1512 | if (dev_data->alias != dev) { |
@@ -1520,10 +1522,14 @@ static int __attach_device(struct device *dev, | |||
1520 | 1522 | ||
1521 | atomic_inc(&dev_data->bind); | 1523 | atomic_inc(&dev_data->bind); |
1522 | 1524 | ||
1525 | ret = 0; | ||
1526 | |||
1527 | out_unlock: | ||
1528 | |||
1523 | /* ready */ | 1529 | /* ready */ |
1524 | spin_unlock(&domain->lock); | 1530 | spin_unlock(&domain->lock); |
1525 | 1531 | ||
1526 | return 0; | 1532 | return ret; |
1527 | } | 1533 | } |
1528 | 1534 | ||
1529 | /* | 1535 | /* |