]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/mtd/mtd_blkdevs.c
mtd: mtd_blkdevs: don't increase 'open' count on error path
[karo-tx-linux.git] / drivers / mtd / mtd_blkdevs.c
index ed8b5e744b12abc15b0db0189c972b3331bd1f0b..424ca5f93c6c37f74304f04a2e393523ae453f7a 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;