diff options
-rw-r--r-- | drivers/mtd/mtd_blkdevs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index ed8b5e744b12..424ca5f93c6c 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c | |||
@@ -215,7 +215,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode) | |||
215 | 215 | ||
216 | mutex_lock(&dev->lock); | 216 | mutex_lock(&dev->lock); |
217 | 217 | ||
218 | if (dev->open++) | 218 | if (dev->open) |
219 | goto unlock; | 219 | goto unlock; |
220 | 220 | ||
221 | kref_get(&dev->ref); | 221 | kref_get(&dev->ref); |
@@ -235,6 +235,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode) | |||
235 | goto error_release; | 235 | goto error_release; |
236 | 236 | ||
237 | unlock: | 237 | unlock: |
238 | dev->open++; | ||
238 | mutex_unlock(&dev->lock); | 239 | mutex_unlock(&dev->lock); |
239 | blktrans_dev_put(dev); | 240 | blktrans_dev_put(dev); |
240 | return ret; | 241 | return ret; |