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

mtd: blktrans: use better error code for unimplemented ioctl()

In commit 50183936254b ("mtd: blktrans: change blktrans_getgeo return
value") we fixed the problem that ioctl(HDIO_GETGEO) might return 0
(success) for mtdblock devices which did not implement the feature and
would leave a blank (zero) result.

But now, let's get the error code right. Other code paths on this ioctl
tend to use -ENOTTY to notify the user that the ioctl() is not supported
for the device, so let's use that instead of -EOPNOTSUPP.

Suggested-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>

+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) : -EOPNOTSUPP; 281 + ret = dev->tr->getgeo ? dev->tr->getgeo(dev, geo) : -ENOTTY; 282 282 unlock: 283 283 mutex_unlock(&dev->lock); 284 284 blktrans_dev_put(dev);