Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755853AbbEURyh (ORCPT ); Thu, 21 May 2015 13:54:37 -0400 Received: from mail-pd0-f177.google.com ([209.85.192.177]:34880 "EHLO mail-pd0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752173AbbEURye (ORCPT ); Thu, 21 May 2015 13:54:34 -0400 Date: Thu, 21 May 2015 10:54:31 -0700 From: Brian Norris To: Richard Weinberger Cc: Wenlin Kang , "linux-mtd@lists.infradead.org" , David Woodhouse , LKML Subject: [PATCH] mtd: blktrans: use better error code for unimplemented ioctl() Message-ID: <20150521175431.GC11598@ld-irv-0074> References: <1431498556-21275-1-git-send-email-wenlin.kang@windriver.com> <20150520193325.GK11598@ld-irv-0074> <20150521080511.GF11112@norris-Latitude-E6410> <555DB0AB.2000801@nod.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <555DB0AB.2000801@nod.at> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1429 Lines: 38 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 Signed-off-by: Brian Norris --- Against l2-mtd.git (linux-next) 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 c545c9325acf..41acc507b22e 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) : -EOPNOTSUPP; + ret = dev->tr->getgeo ? dev->tr->getgeo(dev, geo) : -ENOTTY; unlock: mutex_unlock(&dev->lock); blktrans_dev_put(dev); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/