From patchwork Sun Jan 29 18:23:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 50030 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1845533wrn; Sun, 29 Jan 2023 10:34:14 -0800 (PST) X-Google-Smtp-Source: AK7set89i2wF0FueLY+hJKxZmrqdggW+ShJ0iaNf2icDTcsM8pfYP6F4Mg0SUgO/Dom+lqFPtqBV X-Received: by 2002:a17:907:a42a:b0:84d:4be4:aa2b with SMTP id sg42-20020a170907a42a00b0084d4be4aa2bmr8934103ejc.68.1675017254855; Sun, 29 Jan 2023 10:34:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675017254; cv=none; d=google.com; s=arc-20160816; b=0GWSlD7cqz0gKUXm2JmC/ke8sgqszsD57aHvmi6Puvo08jqIdNuhZ9qisI4nkG4XTl Qev5+S9BN5O16+fQFL61FXdDNrqZvHFiUsq0W9gPRvD1ZO80cYqLuWcV2y3JVGaX2CpQ 7Wzv6rXZ5Y9+TWUc0Cc5CviLYNu+eYCRjN3daWwLYdV5cunfr8ZmR9FspHVMcFF1yxAV B+Iu1A2ol3GLpvizlF2nG8xHunCi7BiJ3LIscb+XsMh8vb8oujKacCjjxE642p2gMlQ+ Brkpy9pGcSwAD2Zsr5zK5d4Ru5cr6TgKzcPY7hiPpUQo6/5Or6qvDWPO4waBxydx4TnU dEpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=1ot/5SY2NBRh52AhPTRcrRcwQg7n9kYBJBx6IGGBT38=; b=Ki/mhm6VLyhvsqeXLvOX30Z+7GV1wvpxGEMzDlC3mcGfqPd5KJIach1y4M/rxvHRjj t6YoUK4ShV9T+jhU/QFzoJ6CW9uJxuRKMPAWk1PmTSsTFL3OoPds20wsD5s7xBlHtyc0 pPex2GPgcawBV6FFsJtX8xuFBMlum1P0ZPxW20CHvFUrxkx4PuP6y+Wmay6aphwb5a0A ltcq9fMVNSRZXE82R9MpG0Xy9Fd+Q3ei8eqb0Au0dFkEfPtK3CIL+Y2Ce9hlXGfnOVYn z25rjvVqUcSMYlFcwaokTU2HImQpHCaDrbxdJvCinqHCzt6OcUb0yeIU2yAl1CcC9J6P aTcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 26-20020a170906101a00b008818fe220c1si7671611ejm.80.2023.01.29.10.33.50; Sun, 29 Jan 2023 10:34:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235286AbjA2SXn (ORCPT + 99 others); Sun, 29 Jan 2023 13:23:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235287AbjA2SXk (ORCPT ); Sun, 29 Jan 2023 13:23:40 -0500 Received: from smtp.smtpout.orange.fr (smtp-12.smtpout.orange.fr [80.12.242.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7021B1C311 for ; Sun, 29 Jan 2023 10:23:37 -0800 (PST) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id MCKlpGwDQMaRbMCL1pnjjv; Sun, 29 Jan 2023 19:23:35 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 29 Jan 2023 19:23:35 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: gregkh@linuxfoundation.org, peterz@infradead.org, pmladek@suse.com, john.ogness@linutronix.de, baolu.lu@linux.intel.com, tglx@linutronix.de, mingo@kernel.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH 2/3] usb: early: xhci-dbc: Optimize early_xdbc_write() Date: Sun, 29 Jan 2023 19:23:09 +0100 Message-Id: <687bbcd940c59fbddd0e3a8b578fd3422962e50f.1675016180.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756382892654211681?= X-GMAIL-MSGID: =?utf-8?q?1756382892654211681?= There is no point in zeroing 'buf'. It would be cleared only once, and if the 'while' loop is executed several times, all but the first run would have a 'dirty' buffer. Moreover, the size of the chunk is computed in the loop and this size is passed to xdbc_bulk_write(). So remove this useless memset(). Signed-off-by: Christophe JAILLET --- Untested. --- drivers/usb/early/xhci-dbc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c index f3e23be227d4..965a24e47c0f 100644 --- a/drivers/usb/early/xhci-dbc.c +++ b/drivers/usb/early/xhci-dbc.c @@ -881,7 +881,7 @@ static void early_xdbc_write(struct console *con, const char *str, u32 n) if (!xdbc.xdbc_reg) return; - memset(buf, 0, XDBC_MAX_PACKET); + while (n > 0) { for (chunk = 0; chunk < XDBC_MAX_PACKET && n > 0; str++, chunk++, n--) {