Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@windriver.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>

authored by

Wenlin Kang and committed by
Brian Norris
50183936 8eeb4c52

+1 -1
+1 -1
drivers/mtd/mtd_blkdevs.c
··· 278 278 if (!dev->mtd) 279 279 goto unlock; 280 280 281 - ret = dev->tr->getgeo ? dev->tr->getgeo(dev, geo) : 0; 281 + ret = dev->tr->getgeo ? dev->tr->getgeo(dev, geo) : -EOPNOTSUPP; 282 282 unlock: 283 283 mutex_unlock(&dev->lock); 284 284 blktrans_dev_put(dev);