Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754017AbbETTdf (ORCPT ); Wed, 20 May 2015 15:33:35 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:35914 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753042AbbETTdd (ORCPT ); Wed, 20 May 2015 15:33:33 -0400 Date: Wed, 20 May 2015 12:33:25 -0700 From: Brian Norris To: Wenlin Kang Cc: dwmw2@infradead.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mtd: blktrans: change blktrans_getgeo rerurn value Message-ID: <20150520193325.GK11598@ld-irv-0074> References: <1431498556-21275-1-git-send-email-wenlin.kang@windriver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1431498556-21275-1-git-send-email-wenlin.kang@windriver.com> 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: 1527 Lines: 45 Hi Wenlin, In the subject: s/rerurn/return/ On Wed, May 13, 2015 at 02:29:16PM +0800, Wenlin Kang wrote: > Modify function blktrans_getgeo()'s return value to -ENXIO 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 return 0, it will make some > application get the wrong information. > > Signed-off-by: Wenlin Kang > --- > 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 2b0c5287..f8bb16e 100644 > --- a/drivers/mtd/mtd_blkdevs.c > +++ b/drivers/mtd/mtd_blkdevs.c > @@ -273,7 +273,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) : -ENXIO; Good catch. I don't think ENXIO is correct in this case, though. Maybe -EOPNOTSUPP or -ENOSYS? The latter might make more sense I guess. > unlock: > mutex_unlock(&dev->lock); > blktrans_dev_put(dev); Thanks, Brian -- 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/