From patchwork Mon Jan 18 11:13:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 366651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C40A5C433DB for ; Mon, 18 Jan 2021 20:07:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8D3A322CAD for ; Mon, 18 Jan 2021 20:07:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389179AbhARUHU (ORCPT ); Mon, 18 Jan 2021 15:07:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:56318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389972AbhARLOU (ORCPT ); Mon, 18 Jan 2021 06:14:20 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C1C2C229C6; Mon, 18 Jan 2021 11:13:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610968419; bh=J2YsekzpW29kxoTz9MkMUaODOQ7MYOALSTt4K9PoRVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vtf957s1eLR0KOkV6JgklLrJCZT+GJTD3y1A+IyfYdJ5jcPNFnuGdK3OEEfECSWT8 ABtLELY3b/FqXEDFQFFKX2gETIb4KPJgvy8+Zj3yAFEbIpn2YhxVMdhRvumW+7LfZF Ms/e5q1scQtPjplCV33yEumo7/ARfCMUqOPSgj4bdVIEhggtGjswwd1allzWqHx9V2 2cDuDguNqkk2C4CV5OVTemInsgrqe3FlMRkL6xvLmz4TliPKXbnqf2pr5Y0uw3UgN/ OuOTrUOEf7NvyUguXR/pblAU4ly+UncqZHiSNd8FHWipMfheqeqtjtLhEs8NCMdvq4 4b5SYo79QOC7Q== Received: from johan by xi with local (Exim 4.93.0.4) (envelope-from ) id 1l1STi-0001KX-96; Mon, 18 Jan 2021 12:13:46 +0100 From: Johan Hovold To: linux-usb@vger.kernel.org Cc: Sheng Long Wang , Wang Sheng Long , Greg Kroah-Hartman , Johan Hovold Subject: [PATCH 4/6] USB: serial: cp210x: drop short control-transfer checks Date: Mon, 18 Jan 2021 12:13:29 +0100 Message-Id: <20210118111331.5048-5-johan@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210118111331.5048-1-johan@kernel.org> References: <20210118111331.5048-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org There's no need to check for short control transfers when sending data so remove the redundant sanity checks. Signed-off-by: Johan Hovold --- drivers/usb/serial/cp210x.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 4f90573c0d2b..360398665c17 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -674,16 +674,13 @@ static int cp210x_write_reg_block(struct usb_serial_port *port, u8 req, kfree(dmabuf); - if (result == bufsize) { - result = 0; - } else { + if (result < 0) { dev_err(&port->dev, "failed set req 0x%x size %d status: %d\n", req, bufsize, result); - if (result >= 0) - result = -EIO; + return result; } - return result; + return 0; } /* @@ -720,17 +717,14 @@ static int cp210x_write_vendor_block(struct usb_serial *serial, u8 type, kfree(dmabuf); - if (result == bufsize) { - result = 0; - } else { + if (result < 0) { dev_err(&serial->interface->dev, "failed to set vendor val 0x%04x size %d: %d\n", val, bufsize, result); - if (result >= 0) - result = -EIO; + return result; } - return result; + return 0; } #endif