Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752748AbbBYSDS (ORCPT ); Wed, 25 Feb 2015 13:03:18 -0500 Received: from p3plex2out04.prod.phx3.secureserver.net ([184.168.131.18]:39935 "EHLO p3plex2out04.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752305AbbBYSDQ convert rfc822-to-8bit (ORCPT ); Wed, 25 Feb 2015 13:03:16 -0500 From: Hartley Sweeten To: Nicholas Krause , "abbotti@mev.co.uk" CC: "gregkh@linuxfoundation.org" , "ravi23ganiga@gmail.com" , "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] comedi: Change error return code for if statement in the function,cb_pcimdas_ai_rinsn Thread-Topic: [PATCH] comedi: Change error return code for if statement in the function,cb_pcimdas_ai_rinsn Thread-Index: AQHQULFowDG593klYE60W/TIJ6/ffJ0BqFtw Date: Wed, 25 Feb 2015 18:03:14 +0000 Message-ID: References: <1424837601-23401-1-git-send-email-xerofoify@gmail.com> In-Reply-To: <1424837601-23401-1-git-send-email-xerofoify@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [184.183.19.121] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1694 Lines: 41 On Tuesday, February 24, 2015 9:13 PM, Nicholas Krause wrote: > This changes us using the incorrect error,-ETIMEOUT when checking if > the channel we are allocating to on the device structure pointer passed > to this function is greater then the maximum available channels for this > device to the correct error for a channel being out of range,-ECHRNG. > > Signed-off-by: Nicholas Krause > --- > drivers/staging/comedi/drivers/cb_pcimdas.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c > index 70dd2c9..d91a6f3 100644 > --- a/drivers/staging/comedi/drivers/cb_pcimdas.c > +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c > @@ -121,7 +121,7 @@ static int cb_pcimdas_ai_rinsn(struct comedi_device *dev, > maxchans = s->n_chan; > > if (chan > (maxchans - 1)) > - return -ETIMEDOUT; /* *** Wrong error code. Fixme. */ > + return -ECHRNG; > > /* configure for sw initiated read */ > d = inb(devpriv->BADR3 + 5); Hmm... This isn't quite right... The 16 single-ended / 8 differential analog input channels on this board is set with a switch on the PCB. The state of the switch should be read when the driver is attached and the subdevice initialized with the correct number of channels. The core will then validate the "chan" number before calling the (*insn_read) operation. Regards, Hartley -- 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/