Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2470287ybk; Sun, 17 May 2020 23:10:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxi7Hog2mG4U2Q7udBZz67fINz5TISf01rML276plb2RgvfLTK9aGtlRQDXhPIXJVgNg0bU X-Received: by 2002:a05:6402:658:: with SMTP id u24mr12493840edx.213.1589782207895; Sun, 17 May 2020 23:10:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589782207; cv=none; d=google.com; s=arc-20160816; b=XTZPoEFz4vzrIxie+k0sdr9PGNH7gDyw/71hEb1ahXM8bGp2Q6528PeWd8D/jVDl3N 3QJFtFlyWzVtPWyR9bKZywcwHcHLeXuhmOP+sjTUclIHC3RK9b2fKiyyT5yn2itar6tz INvPQdPNyyHQ3YVGq4ZD1qF3mDRKY0xIWBdb+mQaybzx6vx4IJHrJzfj4wicx9527a5r DKBLibJq3rIswW6npuEJPLnG9czW7nYFywlO2dK9+bOMl9sy6pbCRSzQStL9M5NlXeQr 8TW5Tb7Vs6T7etEMZgaiaqmePqacysuDw+ztoSxYIAKFfaJq2FUT9KcPJB0P4uLy++9l Sr+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=nWRAj9mXk2c971Xw5A3d0SOEkk/ANezgipyRdm+C8tg=; b=igLUhjn3gK/qySGl052YirDj3Fl0+8Df8NzuEcaxud3IZMY0DE7nMc1zkY+ZYa/YjI VUiNd1PI3GJe3P1mHBQqW2n7l72GL2JlSLtcGQ7+/bXhEpBeC2BLOBRsrgPMlFyvrPll H4G4vGCcvZNXeo8WbIubXXUl1wsS0EUiGVJ5bxCcv82jmL1f7ZKMWgB6K/IH52jK9fBT /0aCgDFP1EwBmTDlslIxiSVm6fWk/m2C2vwhLKBaXC1PNhivu02ZDr9+7ih+uiSfTZVB E/BRWiAu0N4sA2o4t5gomV9qZ2QvXjfYj09BTPbBSyLYEvqvpB365KSXqLebIBOKqQqM MwMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lMp5SeXe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a10si5467708edm.203.2020.05.17.23.09.44; Sun, 17 May 2020 23:10:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lMp5SeXe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726539AbgERGHr (ORCPT + 99 others); Mon, 18 May 2020 02:07:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:34756 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726040AbgERGHq (ORCPT ); Mon, 18 May 2020 02:07:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CFF4220715; Mon, 18 May 2020 06:07:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1589782066; bh=y3lycjDyiclvJUciGJp+yfnl/46okNlvJABn3P8aP5o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lMp5SeXeulxwZB2oCGU0XA620JXmVgVJRKsaATWiCjKIUntUj02dVhBYbhpcFbk/4 vAs1MgBWr3gzULNZdMvoVH4Aa5SKmSOq6+i7vyPZTanDSEzdPAMaia+uJw5kvoc3qr EQphvqogjq0z7aaUSfH5QZqlMFEbv4r8ls9O7b4o= Date: Mon, 18 May 2020 08:07:44 +0200 From: Greg KH To: mani@kernel.org Cc: johan@kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, patong.mxl@gmail.com Subject: Re: [PATCH v3 1/2] usb: serial: Add MaxLinear/Exar USB to Serial driver Message-ID: <20200518060744.GA2845844@kroah.com> References: <20200430184924.31690-1-mani@kernel.org> <20200430184924.31690-2-mani@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200430184924.31690-2-mani@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 01, 2020 at 12:19:23AM +0530, mani@kernel.org wrote: > +static int xr_set_reg(struct usb_serial_port *port, u8 block, u8 reg, > + u8 val) > +{ > + struct usb_serial *serial = port->serial; > + int ret = -EINVAL; > + > + /* XR21V141X uses custom command for writing UART registers */ > + ret = usb_control_msg(serial->dev, > + usb_sndctrlpipe(serial->dev, 0), > + XR_SET_XR21V141X, > + USB_DIR_OUT | USB_TYPE_VENDOR, val, > + reg | (block << 8), NULL, 0, > + USB_CTRL_SET_TIMEOUT); > + > + if (ret < 0) > + dev_err(&port->dev, "Failed to set reg 0x%x status: %d\n", > + reg, ret); > + > + return ret; > +} So if this call is successful, it would return the number of bytes written in the control message. Which is 0. But that's kind of a hack, right? Why not just return 0 to make it more obvious and easier to read, instead of returning 'ret' and making the reader have to realize that you only are writing 0 bytes? > + > +static int xr_get_reg(struct usb_serial_port *port, u8 block, u8 reg, > + u8 *val) > +{ > + struct usb_serial *serial = port->serial; > + void *dmabuf; char *dmabuf; ? > + int ret = -EINVAL; > + > + dmabuf = kmalloc(1, GFP_KERNEL); > + if (!dmabuf) > + return -ENOMEM; > + > + /* XR21V141X uses custom command for reading UART registers */ > + ret = usb_control_msg(serial->dev, > + usb_rcvctrlpipe(serial->dev, 0), > + XR_GET_XR21V141X, > + USB_DIR_IN | USB_TYPE_VENDOR, 0, > + reg | (block << 8), dmabuf, 1, > + USB_CTRL_SET_TIMEOUT); > + > + if (ret == 1) { > + memcpy(val, dmabuf, 1); *val = *dmabuf; ? > + ret = 0; > + } else { > + dev_err(&port->dev, "Failed to get reg 0x%x status: %d\n", > + reg, ret); > + if (ret >= 0) > + ret = -EIO; > + } > + > + kfree(dmabuf); > + > + return ret; > +} Anyway, other than these minor things, this looks good to me: Reviewed-by: Greg Kroah-Hartman