mtd: blktrans: change blktrans_getgeo return value
authorWenlin Kang <wenlin.kang@windriver.com>
Thu, 21 May 2015 06:49:38 +0000 (14:49 +0800)
committerBrian Norris <computersforpeace@gmail.com>
Thu, 21 May 2015 07:26:41 +0000 (00:26 -0700)
Modify function blktrans_getgeo()'s return value to -EOPNOTSUPP when
dev->tr->getgeo == NULL.

We shouldn't make the return value to 0 when dev->tr->getgeo == NULL,
because the function blktrans_getgeo() has an output value "hd_geometry"
which is usually used by some application, if returns 0 (i.e.,
"success"), it will make some application get the wrong information.

Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/mtd_blkdevs.c

index df7c6c70757a6c97b1546330a3b61cc33bdb4e6c..c545c9325acfc11f7ebf5568b20c72d26bea826a 100644 (file)
@@ -278,7 +278,7 @@ static int blktrans_getgeo(struct block_device *bdev, struct hd_geometry *geo)
        if (!dev->mtd)
                goto unlock;
 
-       ret = dev->tr->getgeo ? dev->tr->getgeo(dev, geo) : 0;
+       ret = dev->tr->getgeo ? dev->tr->getgeo(dev, geo) : -EOPNOTSUPP;
 unlock:
        mutex_unlock(&dev->lock);
        blktrans_dev_put(dev);