mtd: mtd_blkdevs: don't increase 'open' count on error path
[pandora-kernel.git] / drivers / mtd / mtd_blkdevs.c
index ed8b5e7..424ca5f 100644 (file)
@@ -215,7 +215,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
 
        mutex_lock(&dev->lock);
 
-       if (dev->open++)
+       if (dev->open)
                goto unlock;
 
        kref_get(&dev->ref);
@@ -235,6 +235,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
                goto error_release;
 
 unlock:
+       dev->open++;
        mutex_unlock(&dev->lock);
        blktrans_dev_put(dev);
        return ret;