From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751649AbbKVIwI (ORCPT ); Sun, 22 Nov 2015 03:52:08 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:36591 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750778AbbKVIwG (ORCPT ); Sun, 22 Nov 2015 03:52:06 -0500 Date: Sun, 22 Nov 2015 09:51:56 +0100 From: Dave Penkler To: Andy Shevchenko Cc: Greg Kroah-Hartman , peter.chen@freescale.com, teuniz@gmail.com, USB , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v5 5/5] Add ioctls to enable and disable local controls on an instrument Message-ID: <20151122085155.GA4581@slacky> References: <20151118083216.GA1845@slacky> <20151118083840.GE1945@slacky> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 18, 2015 at 11:41:30AM +0200, Andy Shevchenko wrote: > On Wed, Nov 18, 2015 at 10:38 AM, Dave Penkler wrote: > > These ioctls provide support for the USBTMC-USB488 control requests > > for REN_CONTROL, GO_TO_LOCAL and LOCAL_LOCKOUT > > Couple of comments below. > > > diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c > > index 2358991..d416a5f 100644 > > --- a/drivers/usb/class/usbtmc.c > > +++ b/drivers/usb/class/usbtmc.c > > @@ -476,6 +476,62 @@ static int usbtmc488_ioctl_read_stb(struct usbtmc_device_data *data, snip > > > + if (rv < 0) { > > + dev_err(dev, "simple usb_control_msg failed %d\n", rv); > > + goto exit; > > + } else if (rv != 1) { > > + dev_warn(dev, "simple usb_control_msg returned %d\n", rv); > > Actually here what king of results could be? 0? 2+? In all cases of > error you have to provide an error code. > We seem to be going round in circles here, last time you suggested to propagate the return value. The non-negative return is the number of bytes transferred which should be 1 unless there is some usb implementation flakiness happening. So I will go back to returning -EIO. > > + goto exit; > > + } > > + > > + if (buffer[0] != USBTMC_STATUS_SUCCESS) { > > + dev_err(dev, "simple control status returned %x\n", buffer[0]); > > + rv = -EIO; > > + goto exit; > > + } > > + rv = 0; > > + > > + exit: > > + kfree(buffer); > > + return rv; > > +} > > + > > -- > With Best Regards, > Andy Shevchenko cheers, -Dave