mtd: blktrans: change blktrans_getgeo return value
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Tue Jun 23 10:59:06 PDT 2015
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=50183936254b76997d222cd36bac997ebf8115de
Commit: 50183936254b76997d222cd36bac997ebf8115de
Parent: 8eeb4c521a8047ea73da0d6eb2d87a7f60cdd99a
Author: Wenlin Kang <wenlin.kang at windriver.com>
AuthorDate: Thu May 21 14:49:38 2015 +0800
Committer: Brian Norris <computersforpeace at gmail.com>
CommitDate: Thu May 21 00:26:41 2015 -0700
mtd: blktrans: change blktrans_getgeo return value
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 at windriver.com>
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
drivers/mtd/mtd_blkdevs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index df7c6c7..c545c93 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -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);
More information about the linux-mtd-cvs
mailing list