Commit 54fe0e96 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] err2-27: i2o_claim_device() locking fix

Found by the Stanford locking checker
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f286b63e
......@@ -831,12 +831,14 @@ static int i2o_issue_claim(u32 cmd, struct i2o_controller *c, int tid, u32 type)
int i2o_claim_device(struct i2o_device *d, struct i2o_handler *h)
{
int ret = 0;
down(&i2o_configuration_lock);
if (d->owner) {
printk(KERN_INFO "Device claim called, but dev already owned by %s!",
h->name);
up(&i2o_configuration_lock);
return -EBUSY;
ret = -EBUSY;
goto out;
}
d->owner=h;
......@@ -844,10 +846,11 @@ int i2o_claim_device(struct i2o_device *d, struct i2o_handler *h)
I2O_CLAIM_PRIMARY))
{
d->owner = NULL;
return -EBUSY;
ret = -EBUSY;
}
out:
up(&i2o_configuration_lock);
return 0;
return ret;
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment