mtd: blktrans: use better error code for unimplemented ioctl()
authorBrian Norris <computersforpeace@gmail.com>
Thu, 21 May 2015 17:44:32 +0000 (10:44 -0700)
committerBrian Norris <computersforpeace@gmail.com>
Thu, 21 May 2015 17:44:32 +0000 (10:44 -0700)
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>
drivers/mtd/mtd_blkdevs.c

index c545c9325acfc11f7ebf5568b20c72d26bea826a..41acc507b22ed942bee2f0df6f43dda073efeb99 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) : -EOPNOTSUPP;
+       ret = dev->tr->getgeo ? dev->tr->getgeo(dev, geo) : -ENOTTY;
 unlock:
        mutex_unlock(&dev->lock);
        blktrans_dev_put(dev);