Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 252481
b: refs/heads/master
c: 94735ec
h: refs/heads/master
i:
  252479: 0cd1009
v: v3
  • Loading branch information
Artem Bityutskiy authored and David Woodhouse committed May 25, 2011
1 parent 09be489 commit 8f343d8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5c39c4c54c585e13a8d6b5a8f64af682e7c68091
refs/heads/master: 94735ec4044a6d318b83ad3c5794e931ed168d10
24 changes: 21 additions & 3 deletions trunk/drivers/mtd/mtd_blkdevs.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,33 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
kref_get(&dev->ref);
__module_get(dev->tr->owner);

if (dev->mtd) {
ret = dev->tr->open ? dev->tr->open(dev) : 0;
__get_mtd_device(dev->mtd);
if (!dev->mtd)
goto unlock;

if (dev->tr->open) {
ret = dev->tr->open(dev);
if (ret)
goto error_put;
}

ret = __get_mtd_device(dev->mtd);
if (ret)
goto error_release;

unlock:
mutex_unlock(&dev->lock);
blktrans_dev_put(dev);
return ret;

error_release:
if (dev->tr->release)
dev->tr->release(dev);
error_put:
module_put(dev->tr->owner);
kref_put(&dev->ref, blktrans_dev_release);
mutex_unlock(&dev->lock);
blktrans_dev_put(dev);
return ret;
}

static int blktrans_release(struct gendisk *disk, fmode_t mode)
Expand Down

0 comments on commit 8f343d8

Please sign in to comment.