From patchwork Wed Jul 4 15:02:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10507155 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 77301600F5 for ; Wed, 4 Jul 2018 15:03:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 683D928D81 for ; Wed, 4 Jul 2018 15:03:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CBE228D85; Wed, 4 Jul 2018 15:03:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B059A28D81 for ; Wed, 4 Jul 2018 15:02:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752794AbeGDPCz (ORCPT ); Wed, 4 Jul 2018 11:02:55 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:43048 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752145AbeGDPCw (ORCPT ); Wed, 4 Jul 2018 11:02:52 -0400 Received: by mail-lj1-f193.google.com with SMTP id r13-v6so4518520ljg.10 for ; Wed, 04 Jul 2018 08:02:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=0p6rNPsVdmtpSiW4rgUK0+Kvrm2arIB6hiF2p8UF2yg=; b=jV6J0kDtMr2Lj2Jjs5jftP2+z4nSn0gExNlkDYycJq1EK5OsyEEgpZDO9qmG04I+Rb t1AT66M8Xv7hpz6E9fZ29FoyxjcVDMK/dljAWjh6wiZV+X7q6ZS3gZQ1K123EDmC8gfF tdCGOliQNh+bVvH9394C3vaf9R5dttCuzZDLwCB3wD7Y8Ik9BNeutFMrBSHMj7P11xrD 3XS8QBCdIrTQ7fXTKhzrwe7avd6YdrVkIb0peEI28zNeGUtCD3CcIYQ/kKr895Muh5Uz lhFsE7ky0b/qJsINX1ACB3uQrocSu5toWOmE24cX+MooeJTz5rN906BO24OME0w85Hkn itTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=0p6rNPsVdmtpSiW4rgUK0+Kvrm2arIB6hiF2p8UF2yg=; b=f4r2d7ATsONxbLEq6RvXzjXXr/WHqAw1kxG9E4uOBLiX5v7oHAny+SRPJ4sC25hsuc UvIC5iSF9s4QjDSq9ClTKUDme/sVRwVWnVJ8wR+Phh26J7/1CsdYrQuibNjpI6Y3W5qb Ppb1yliAPKpRmKsc7b/ytnTszH5ajrR+yejLDfzJeSt4S6b7UAR3JI1Q9zMu1lRchyAd a8PBEavah8Wg2PD6G+uIm/KgoznO7e6LoGZKrAmga2x3uMnICbFnzM2lEuAoZBs+vyWv VG7wYAbWWt0B2jk6KG3bjSejqe1OzoJaFMHmJfVsF8yANrbGen5d+1KYqEOSSQaMKWhy ZGnw== X-Gm-Message-State: APt69E0YPKw6ZABw+Zxf2cEJLy0HgOMamjETVATM8bhj//8U5cm/2oNw Pk7zVmvJJUZfFUcEu8Gg16k= X-Google-Smtp-Source: AAOMgpcWdkbGj5fc9aSD+8jxuKzz/tTC69gm9kfuVpwtG3apEyoT3DvfUSfsLFKdz603tCrLFQPquQ== X-Received: by 2002:a2e:9c82:: with SMTP id x2-v6mr1672262lji.131.1530716570735; Wed, 04 Jul 2018 08:02:50 -0700 (PDT) Received: from xi.terra (c-8bb2e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.178.139]) by smtp.gmail.com with ESMTPSA id z4-v6sm832300lfa.57.2018.07.04.08.02.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Jul 2018 08:02:48 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1fajIm-00078j-7i; Wed, 04 Jul 2018 17:02:40 +0200 From: Johan Hovold To: Johan Hovold Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org Subject: [PATCH 4/4] USB: serial: kobil_sct: add missing version error handling Date: Wed, 4 Jul 2018 17:02:19 +0200 Message-Id: <20180704150219.27389-4-johan@kernel.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180704150219.27389-1-johan@kernel.org> References: <20180704150219.27389-1-johan@kernel.org> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add missing version-request error handling and suppress printing of the (zeroed) transfer-buffer content in case of errors. Signed-off-by: Johan Hovold --- drivers/usb/serial/kobil_sct.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index a6ebed1e0f20..e9882ba20933 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c @@ -190,8 +190,10 @@ static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port) KOBIL_TIMEOUT ); dev_dbg(dev, "%s - Send get_HW_version URB returns: %i\n", __func__, result); - dev_dbg(dev, "Hardware version: %i.%i.%i\n", transfer_buffer[0], - transfer_buffer[1], transfer_buffer[2]); + if (result >= 3) { + dev_dbg(dev, "Hardware version: %i.%i.%i\n", transfer_buffer[0], + transfer_buffer[1], transfer_buffer[2]); + } /* get firmware version */ result = usb_control_msg(port->serial->dev, @@ -205,8 +207,10 @@ static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port) KOBIL_TIMEOUT ); dev_dbg(dev, "%s - Send get_FW_version URB returns: %i\n", __func__, result); - dev_dbg(dev, "Firmware version: %i.%i.%i\n", transfer_buffer[0], - transfer_buffer[1], transfer_buffer[2]); + if (result >= 3) { + dev_dbg(dev, "Firmware version: %i.%i.%i\n", transfer_buffer[0], + transfer_buffer[1], transfer_buffer[2]); + } if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) {