From patchwork Mon Oct 2 16:16:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 147436 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1642172vqb; Mon, 2 Oct 2023 12:22:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGaQ0/Sj8ssOSyhBe0j2sBX5j5ogqQpvrRnZXkmGxuoxYghfezWtH8uIfH0mOZ2IxD3jjAx X-Received: by 2002:a05:6808:20a8:b0:3ab:8e86:fc26 with SMTP id s40-20020a05680820a800b003ab8e86fc26mr14914938oiw.46.1696274545409; Mon, 02 Oct 2023 12:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696274545; cv=none; d=google.com; s=arc-20160816; b=IPOBfcNyWWURAug/SvsxTwgh1KJ9ND7Jbs9cGsuw0Bvt7kWCZ5D3Us1USM41oqt5wE 1uCQB0h07pF0iAMbeOKunF1zOdRH4u5WCp08g6Qbyw8Lbs0/uVsvLlAutrZZ0w9uZfLi f2PWZ+UTx9Op4U2bXUdF8GCB+WV5WtqO9MiyjKOMGPmltRLbMzrP1vNXnytKtD3/TTKm OZ/aF0uhD8c9zgN6FndAPfA+QLwlOWCewOMdoAK2OnfrsUir3ts3BYuGj9gSLz36aaFW gkkzAmLHs68MFE7nYT2pzo83dRuBDZo8G+91fnQwLfbZcOzj5UeNMjVbrWyG2COO/Cgw /sFQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=8yy3hLeRFCiFZhwewQmcU2ZY7qa3cgCNLrOpWfOyynA=; fh=YYrWResMAxfU+C17BdM7l/WUXXvK87rdz5rOaZ9UMD0=; b=R239WasVbhwwRrSQAqMTF4gkw/79aQJiii91Cbk7mpkPcbcOw3JwWiJ7Eg/NhgRQtU ecSyHWM5c6dEP9Lf+XKIzaBiW7FOCvVpHvkOvTmyIM+x1nh9xo62g5GKo0V0mALCRNP3 22bch+XcZt/v7oHzBaKtgR56iSyuwohus+D4fMBzL89IB9dLOrkIQrOiSyi5iXrrIDip +kSsAnBKiyGEKba4TfyvGHDjxan65xr9TeWqCvlA2a2HAjxpWktiJd3UtFYRyLZ/hNYg E06WK7yxbZv/C7jdPtVOGLgoYC+ehst1HdRx8SrzISHLrj1+wCBeKoddI4MAFJ/L+YUB IRkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YQUCYh+F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id a21-20020a63e855000000b0057a32c18a47si28180124pgk.47.2023.10.02.12.22.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 12:22:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YQUCYh+F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3BBAE80425A2; Mon, 2 Oct 2023 09:19:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238393AbjJBQS6 (ORCPT + 18 others); Mon, 2 Oct 2023 12:18:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238295AbjJBQSy (ORCPT ); Mon, 2 Oct 2023 12:18:54 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84587B3; Mon, 2 Oct 2023 09:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696263531; x=1727799531; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=wKIv3sJ1clYjdqjwiVvVRD9CCUCGlQHTF5I50Li2+CE=; b=YQUCYh+FujSv3BhhaOmeakFbdUAU+jnOEeWihojYFtNu2RSRdMHSSEZ4 ySGVsIVmpr3JHAdngGVz9OeYgwpQ0cAMBVJRzpksJZtUFu7xViO+ooOFA d8PLSDXZEzHptzYIrqto1fOE5iJfgcI1zdtTykL9Jkcd6racFo7iFn8FN sFJ2lg6J5NlIGbH3FtnkaCOw3pFVW275PDaLAjQzcNqzpeX8Ux5Zc8Img v2d2CnsYtV9Y+8t+IFYUMAgpfKWmTgGb8LpaC4LolnKVAa9p5sNbrergz jPjGkCgkIY9x6pQ5fMMF5+961zGR4GCbaOl/cWqVn3dufFBSxGi6qaSRF A==; X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="362949518" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="362949518" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 09:16:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="816339772" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="816339772" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 02 Oct 2023 09:16:21 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1B2D81A7; Mon, 2 Oct 2023 19:16:20 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mathias Nyman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mathias Nyman , Greg Kroah-Hartman Subject: [PATCH v1 01/10] xhci: dbc: Drop duplicate checks for dma_free_coherent() Date: Mon, 2 Oct 2023 19:16:01 +0300 Message-Id: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE autolearn=ham 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 02 Oct 2023 09:19:01 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778672777656635314 X-GMAIL-MSGID: 1778672777656635314 dma_free_coherent() is NULL-aware, not necessary to check for the parameter twice. Drop duplicate conditionals in the caller. Signed-off-by: Andy Shevchenko --- drivers/usb/host/xhci-dbgcap.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c index b40d9238d447..9e9ce3711813 100644 --- a/drivers/usb/host/xhci-dbgcap.c +++ b/drivers/usb/host/xhci-dbgcap.c @@ -28,7 +28,7 @@ static void dbc_ring_free(struct device *dev, struct xhci_ring *ring) if (!ring) return; - if (ring->first_seg && ring->first_seg->trbs) { + if (ring->first_seg) { dma_free_coherent(dev, TRB_SEGMENT_SIZE, ring->first_seg->trbs, ring->first_seg->dma); @@ -394,9 +394,8 @@ static int dbc_erst_alloc(struct device *dev, struct xhci_ring *evt_ring, static void dbc_erst_free(struct device *dev, struct xhci_erst *erst) { - if (erst->entries) - dma_free_coherent(dev, sizeof(struct xhci_erst_entry), - erst->entries, erst->erst_dma_addr); + dma_free_coherent(dev, sizeof(struct xhci_erst_entry), erst->entries, + erst->erst_dma_addr); erst->entries = NULL; } @@ -543,11 +542,8 @@ static void xhci_dbc_mem_cleanup(struct xhci_dbc *dbc) xhci_dbc_eps_exit(dbc); - if (dbc->string) { - dma_free_coherent(dbc->dev, dbc->string_size, - dbc->string, dbc->string_dma); - dbc->string = NULL; - } + dma_free_coherent(dbc->dev, dbc->string_size, dbc->string, dbc->string_dma); + dbc->string = NULL; dbc_free_ctx(dbc->dev, dbc->ctx); dbc->ctx = NULL; From patchwork Mon Oct 2 16:16:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 147568 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1738636vqb; Mon, 2 Oct 2023 16:01:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFk7WCxZ2haHD8w8B26n6Fj18wm3ibtR0EavlshT2GHVBe3FRq6wzYTFVqVJ4JxkNDNdzmu X-Received: by 2002:a05:6358:785:b0:142:f9dd:5aa with SMTP id n5-20020a056358078500b00142f9dd05aamr15025959rwj.0.1696287663134; Mon, 02 Oct 2023 16:01:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696287663; cv=none; d=google.com; s=arc-20160816; b=j2MM4ZA/glcyKyGjgJnBN9X6nsopGPtrjw6PtwSHKgNQwoNwIc5PVLBPH1/N5ZCYU3 75OXFIEcpxX0e2h5SR0E2g35JRD3XhFdZ/C4RkpqsKK3qw9iET/9yNs570l1iaPxttHy hNjORBco8UIFKpCy84jo2TsttvdYDaPWOOc+NHRwNzfzNbjQY72yCub/IX/9TzzjQlss Ii3asFIlKChSIVstQdFD3ydgVxD6a6tuUwwUSPLIU4JhywvaeNHl4jkQjQP4W9jV0s5P gT0ksguFwoJDoz74GzullxXRj31qEGuq8B7xZffijJySGgrwtTrafVgA5kpCeaIWyO8s AabA== 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 :dkim-signature; bh=j60jGTg3G58JVB3Frw5diCuTaOBrDrAQrr7tkpco1DE=; fh=YYrWResMAxfU+C17BdM7l/WUXXvK87rdz5rOaZ9UMD0=; b=sD7T4tTL7kx3vth2Te1kczxnEpsAU39Xteov87XlbxIvbdGjs+XEmKD4yVtjMczrge nbuNraIOJ8qfGnhYCWmouv7Nb9mvavFte/Xk4LMl1elw6XWLcuSZ0r159qe+vXB8UzmU nDp5QA6YBzxt1ZobgEnRga+WKDfMQH8rm5AlCGEMigwSXFePhj7gjOulk1nLnksfzb6q 7eKC/LwCmZuI3acz2iDMs5t2LrHRZk59hPJIyuK5elU45HZixLCKBCe5jTVbOolZduwx aRuSW+MvMRwECyYYMOFWDcvNOSxwsiHmvRabwh+7G5xWbazGOggZ3XSiKOxABskS9k3T 7v7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PpFW3mKA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id k10-20020aa788ca000000b00690f886b1bcsi18271pff.392.2023.10.02.16.01.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 16:01:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PpFW3mKA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id C0A54806822D; Mon, 2 Oct 2023 09:20:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238419AbjJBQTS (ORCPT + 18 others); Mon, 2 Oct 2023 12:19:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238457AbjJBQTP (ORCPT ); Mon, 2 Oct 2023 12:19:15 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BE5BCD6; Mon, 2 Oct 2023 09:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696263548; x=1727799548; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5wFq2LWIAxkbz3owrFJUzWLLHVZI7rE5EIksKjGKEtQ=; b=PpFW3mKAiAIUu2fzvk8U0OGsGAiZ1zEf0lfKQdCsCXM/SvSOawp4DSSm gBr0CkqT9xF/MMkhcnaQHit8mha54gqe+6ArH+fpaPycYhX9Osk6raeMP LfQP62lcRDkFspccQpxX14dkVHTGIIZDB3lD727ML9hp2u3oKf5YjIfi1 PUS4C7UuRhmV3U52uneuKxZwLsbOXPg/vNqijZu6u9/xCzV+DkBN5CTpS xt1kWslJIJFQQ8zmgPIOlh1apUK5icYWqzgBXc2EZqhjVOqrqtZYzuZUz blcC/29iGAdPU16Z/nV7ff3d8xvLXfqmJFvcTailbg/q65fSYjppj5dkX g==; X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="382588645" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="382588645" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 09:16:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="841031505" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="841031505" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 02 Oct 2023 09:16:21 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2AAC894; Mon, 2 Oct 2023 19:16:20 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mathias Nyman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mathias Nyman , Greg Kroah-Hartman Subject: [PATCH v1 02/10] xhci: dbc: Convert to use sysfs_streq() Date: Mon, 2 Oct 2023 19:16:02 +0300 Message-Id: <20231002161610.2648818-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> References: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 02 Oct 2023 09:20:10 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778686532601408391 X-GMAIL-MSGID: 1778686532601408391 It's standard approach to parse values from user space by using sysfs_streq(). Make driver use it. Signed-off-by: Andy Shevchenko --- drivers/usb/host/xhci-dbgcap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c index 9e9ce3711813..f505b79afe53 100644 --- a/drivers/usb/host/xhci-dbgcap.c +++ b/drivers/usb/host/xhci-dbgcap.c @@ -957,9 +957,9 @@ static ssize_t dbc_store(struct device *dev, xhci = hcd_to_xhci(dev_get_drvdata(dev)); dbc = xhci->dbc; - if (!strncmp(buf, "enable", 6)) + if (sysfs_streq(buf, "enable")) xhci_dbc_start(dbc); - else if (!strncmp(buf, "disable", 7)) + else if (sysfs_streq(buf, "disable")) xhci_dbc_stop(dbc); else return -EINVAL; From patchwork Mon Oct 2 16:16:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 147453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1664645vqb; Mon, 2 Oct 2023 13:09:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFnzOdVGiHRDLV3cbgzpTI46pCOIN75KRwZt5eKznIvqcjfpbI9jkh349RdHCht4GvgtSlq X-Received: by 2002:a17:903:32c2:b0:1c2:193e:1126 with SMTP id i2-20020a17090332c200b001c2193e1126mr817016plr.28.1696277373574; Mon, 02 Oct 2023 13:09:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696277373; cv=none; d=google.com; s=arc-20160816; b=Cf2zj5FUkTu0hD+qagFyYDe7FWdPPmuKVHnCnstkT+WSKgo6T0etbXJn3oyjUBoJQe i1ZI42ohgcsNmspWQ6lkc1g9PyLVVhQWHX8CajsCTOQoPfg2eQuoLberFM3jGkiV97lA E56HnyYAcy06VIC29rSIxoD8veCy0FiI3sCHpVEKykYOxVC5tumYfFZpoSRA9GECmJIZ rUxkW+9yGymndQvcgFDZ/WA8doknzai9T68HtSA4oR6F3lycxg/YDJwCXmtSxbFqxnGB s8Z3Lw2m2JdGlwf2Wdr2UyV3yfzVvhGVc/g4jkN29n01mHumRWbolyDjas4HN5c9H1jT /x4Q== 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 :dkim-signature; bh=o4fMn9is2DkH26LM8HhMdjzjpDqoSOnEdBkUnC/oiDg=; fh=YYrWResMAxfU+C17BdM7l/WUXXvK87rdz5rOaZ9UMD0=; b=Ns/CVS0wJ/JKoHZVItVOSqEfRnVsj5EiV/49xDNAaTx/eIl/TvffDJ9Gj67fGROhcQ Q5dp+5fWyrdoRu1I/fNjjZFQ0hm/V+ztZNEnNQWSSOkDIAYi23d6l3VPrdu5zsMKld5b dQcOChhcdhD/oMXeWITYmojUC8LF1Xq4jkcMWAQX3iQtxyOlgp5PSFKf3mufFh+HA91A IlhI2fBUfGCUe5ArthtLcJ0VaJbuTyoYz5NRDhntHz8QISLsgb4MLhF6tu9t3av88xzt 04uXiSie8tuOUEPuOw9jLnzanGd4YrsKTbPftRn8PQkWf7w1XZD+jHl+uY6RiLm3zW04 8lVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BDKy8ml9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id u12-20020a170902e80c00b001b9eb5d1ea2si30064782plg.198.2023.10.02.13.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 13:09:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BDKy8ml9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 5A818804B026; Mon, 2 Oct 2023 09:19:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238286AbjJBQSy (ORCPT + 18 others); Mon, 2 Oct 2023 12:18:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238048AbjJBQSx (ORCPT ); Mon, 2 Oct 2023 12:18:53 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0559493; Mon, 2 Oct 2023 09:18:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696263529; x=1727799529; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CY4OM5esL8i/3kUHybBmDSjRpzOpgGo+r8iIQDCl14A=; b=BDKy8ml9CK0ISKHn6ltB8qkcW1vsU4Lb6LFS4B/NJ1JHTBfXzHLEmA8a HCyOfrm1fvCVwd88SyK9xDq0KR7/KnxE0VrnAUgIxuamPkAfpuT6TUkbP qWY6/AQhR5mPVd4mFETgcX6XISHZ5M0cXpPm4A86+6K5GXm2QkxRWKo2C NkhAnn8r6gSxeDfQ0TSDxkWHqJX7Jk3zlDILrfpyPd9oCH+bNqJ5cZEVi 0PJD306z4UUOGfSRJOi36jdNt1B8EZfQYvXDrHwbqKmoSKqTy5e6auMqa QlRJiG/tpnt2et69ieBWaTaQJo2vapNYdq67d2YfPDVYlAVbheUtUPNAx A==; X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="362949511" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="362949511" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 09:16:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="816339768" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="816339768" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 02 Oct 2023 09:16:21 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3069B2FF; Mon, 2 Oct 2023 19:16:20 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mathias Nyman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mathias Nyman , Greg Kroah-Hartman Subject: [PATCH v1 03/10] xhci: dbc: Use sysfs_emit() to instead of scnprintf() Date: Mon, 2 Oct 2023 19:16:03 +0300 Message-Id: <20231002161610.2648818-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> References: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 02 Oct 2023 09:19:22 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778675743397933437 X-GMAIL-MSGID: 1778675743397933437 Follow the advice of the Documentation/filesystems/sysfs.rst and show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: Andy Shevchenko --- drivers/usb/host/xhci-dbgcap.c | 43 +++++++++++++--------------------- drivers/usb/host/xhci-dbgcap.h | 1 + 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c index f505b79afe53..92869c67a430 100644 --- a/drivers/usb/host/xhci-dbgcap.c +++ b/drivers/usb/host/xhci-dbgcap.c @@ -910,6 +910,15 @@ static void xhci_dbc_handle_events(struct work_struct *work) mod_delayed_work(system_wq, &dbc->event_work, 1); } +static const char * const dbc_state_strings[DS_MAX] = { + [DS_DISABLED] = "disabled", + [DS_INITIALIZED] = "initialized", + [DS_ENABLED] = "enabled", + [DS_CONNECTED] = "connected", + [DS_CONFIGURED] = "configured", + [DS_STALLED] = "stalled", +}; + static ssize_t dbc_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -921,30 +930,10 @@ static ssize_t dbc_show(struct device *dev, xhci = hcd_to_xhci(dev_get_drvdata(dev)); dbc = xhci->dbc; - switch (dbc->state) { - case DS_DISABLED: - p = "disabled"; - break; - case DS_INITIALIZED: - p = "initialized"; - break; - case DS_ENABLED: - p = "enabled"; - break; - case DS_CONNECTED: - p = "connected"; - break; - case DS_CONFIGURED: - p = "configured"; - break; - case DS_STALLED: - p = "stalled"; - break; - default: - p = "unknown"; - } + if (dbc->state >= ARRAY_SIZE(dbc_state_strings)) + return sysfs_emit(buf, "unknown\n"); - return sprintf(buf, "%s\n", p); + return sysfs_emit(buf, "%s\n", dbc_state_strings[dbc->state]); } static ssize_t dbc_store(struct device *dev, @@ -977,7 +966,7 @@ static ssize_t dbc_idVendor_show(struct device *dev, xhci = hcd_to_xhci(dev_get_drvdata(dev)); dbc = xhci->dbc; - return sprintf(buf, "%04x\n", dbc->idVendor); + return sysfs_emit(buf, "%04x\n", dbc->idVendor); } static ssize_t dbc_idVendor_store(struct device *dev, @@ -1017,7 +1006,7 @@ static ssize_t dbc_idProduct_show(struct device *dev, xhci = hcd_to_xhci(dev_get_drvdata(dev)); dbc = xhci->dbc; - return sprintf(buf, "%04x\n", dbc->idProduct); + return sysfs_emit(buf, "%04x\n", dbc->idProduct); } static ssize_t dbc_idProduct_store(struct device *dev, @@ -1056,7 +1045,7 @@ static ssize_t dbc_bcdDevice_show(struct device *dev, xhci = hcd_to_xhci(dev_get_drvdata(dev)); dbc = xhci->dbc; - return sprintf(buf, "%04x\n", dbc->bcdDevice); + return sysfs_emit(buf, "%04x\n", dbc->bcdDevice); } static ssize_t dbc_bcdDevice_store(struct device *dev, @@ -1096,7 +1085,7 @@ static ssize_t dbc_bInterfaceProtocol_show(struct device *dev, xhci = hcd_to_xhci(dev_get_drvdata(dev)); dbc = xhci->dbc; - return sprintf(buf, "%02x\n", dbc->bInterfaceProtocol); + return sysfs_emit(buf, "%02x\n", dbc->bInterfaceProtocol); } static ssize_t dbc_bInterfaceProtocol_store(struct device *dev, diff --git a/drivers/usb/host/xhci-dbgcap.h b/drivers/usb/host/xhci-dbgcap.h index 51a7ab3ba0ca..e39e3ae1677a 100644 --- a/drivers/usb/host/xhci-dbgcap.h +++ b/drivers/usb/host/xhci-dbgcap.h @@ -82,6 +82,7 @@ enum dbc_state { DS_CONNECTED, DS_CONFIGURED, DS_STALLED, + DS_MAX }; struct dbc_ep { From patchwork Mon Oct 2 16:16:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 147555 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1733119vqb; Mon, 2 Oct 2023 15:45:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IExug7ZChDR24/H/u5rGK6dEQ1G/yr1VEJmb8Ql1cdXXLGpEFE3ltor2ymFJ7aRZuUIuBCE X-Received: by 2002:a1f:e182:0:b0:495:ee2e:23f9 with SMTP id y124-20020a1fe182000000b00495ee2e23f9mr8634757vkg.15.1696286753532; Mon, 02 Oct 2023 15:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696286753; cv=none; d=google.com; s=arc-20160816; b=bDB+EWPBSf+c9mQNSkn5EDSWdmeVSQJLA6U+JIfhX5aF9Y5hpi8vie3PbtbOjxAm+y 3ZHFN+91d3qtQx2YTfbyvd9bzI2f7wTpxPGI8Zx5tisQfqSQ7k9HRrjHKrUoibLNUPPa 18YtD2+BD+lqf7T92fqB8vxlOy9NIkkukXKPEYOcRzdVfSVLEeCpg/8/NIBz/d/My2dv prq0Qw9rcLC5eyPcr4EcFjdnFoHSdLAHELbBptk+rzmNiqKI9FRGoUKxo1BNN92avBzI bZEPvxZVqnUXTGi0sHgzKS/sSO4OzCDsM1v9YMAYiBqNoQahiiVobWW+Es8tXYIW93Rf DO/Q== 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 :dkim-signature; bh=Am5QzD8ZaoRV9QEP5+uaiZxs8r5wgD2p63PkFtjvR7M=; fh=YYrWResMAxfU+C17BdM7l/WUXXvK87rdz5rOaZ9UMD0=; b=y05PoSmRW4Gg8cc3FmpNnkGXQeGq/PF4h+B8t2+KkR3xjv8Cmoy6XcmhVcKGyCkTWf I4OlpMnA4vQjl0NEyB9nzd4xCfZN3d8G3Z5TFStMzC9CGVvz7DJORs7r8BsvVQq8rLmY 4xMc2qo0DE51AU6jjapViCjbf7lnDnECRTIfj/PBDQpDEqpAAA91/5m9uD3rrVFrEkyu kcG5KlIfEaFpvFMDBM9DjHuTdkFG4OZ5mUmsIgIOjitmvEn+kmYMwgfnfc9Zls3rD92d f+P9OBPO+r8YX90bSh/U0RrwLf5gYGon6qc+90E/uwxBgIm/E5kVyjdJj5qf/gGDFDtD JY7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=G1fIu1hh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id em9-20020a17090b014900b00276bdabe471si8390932pjb.163.2023.10.02.15.45.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 15:45:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=G1fIu1hh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 7BE9180D44E3; Mon, 2 Oct 2023 09:19:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238425AbjJBQTD (ORCPT + 18 others); Mon, 2 Oct 2023 12:19:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238302AbjJBQSz (ORCPT ); Mon, 2 Oct 2023 12:18:55 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2EE3B8; Mon, 2 Oct 2023 09:18:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696263532; x=1727799532; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eRA4GqvkNOBVpjjvvEdbopHkDW3aOk0+GBRNEkvgsAo=; b=G1fIu1hhfcADQxKgfkynBKRfq+2e4cZy0Ubt4ddWPl+k4D47VmTRrXK0 9ntkl/9cbwl0dO31bLI2BRmT+vmrZ5SvlXFzh9hqCCteKZCWriWwGTJ8D glaw1rvpuXZmt7/hFPQ7wWhTNskyOH4psjhTaC2pr+qTFbVgHCYqAt1Jp bZgdUKdzJoXcbHfTWJXJdGesXx89JgLnTdxSN1CYUranIpyfG5QDS7Rjf ezwVD/4fENpjbC80PYAmt01lLW/vOQgw1z6d3BpYhSfTKlegPQN0nihUU RFGUozQe4QcV5Vh3mahIsbPvt4a3kdroYDIEm7TX5lsgy90JdJ62HaZKg g==; X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="362949520" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="362949520" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 09:16:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="816339773" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="816339773" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 02 Oct 2023 09:16:21 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 38D77345; Mon, 2 Oct 2023 19:16:20 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mathias Nyman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mathias Nyman , Greg Kroah-Hartman Subject: [PATCH v1 04/10] xhci: dbc: Use ATTRIBUTE_GROUPS() Date: Mon, 2 Oct 2023 19:16:04 +0300 Message-Id: <20231002161610.2648818-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> References: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE autolearn=ham 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 02 Oct 2023 09:19:12 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778685578905150466 X-GMAIL-MSGID: 1778685578905150466 Embrace ATTRIBUTE_GROUPS() to avoid boiler plate code. This should not introduce any functional changes. Signed-off-by: Andy Shevchenko --- drivers/usb/host/xhci-dbgcap.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c index 92869c67a430..3c90410e9cde 100644 --- a/drivers/usb/host/xhci-dbgcap.c +++ b/drivers/usb/host/xhci-dbgcap.c @@ -1124,7 +1124,7 @@ static DEVICE_ATTR_RW(dbc_idProduct); static DEVICE_ATTR_RW(dbc_bcdDevice); static DEVICE_ATTR_RW(dbc_bInterfaceProtocol); -static struct attribute *dbc_dev_attributes[] = { +static struct attribute *dbc_dev_attrs[] = { &dev_attr_dbc.attr, &dev_attr_dbc_idVendor.attr, &dev_attr_dbc_idProduct.attr, @@ -1132,10 +1132,7 @@ static struct attribute *dbc_dev_attributes[] = { &dev_attr_dbc_bInterfaceProtocol.attr, NULL }; - -static const struct attribute_group dbc_dev_attrib_grp = { - .attrs = dbc_dev_attributes, -}; +ATTRIBUTE_GROUPS(dbc_dev); struct xhci_dbc * xhci_alloc_dbc(struct device *dev, void __iomem *base, const struct dbc_driver *driver) @@ -1161,7 +1158,7 @@ xhci_alloc_dbc(struct device *dev, void __iomem *base, const struct dbc_driver * INIT_DELAYED_WORK(&dbc->event_work, xhci_dbc_handle_events); spin_lock_init(&dbc->lock); - ret = sysfs_create_group(&dev->kobj, &dbc_dev_attrib_grp); + ret = sysfs_create_groups(&dev->kobj, &dbc_dev_groups); if (ret) goto err; @@ -1180,7 +1177,7 @@ void xhci_dbc_remove(struct xhci_dbc *dbc) xhci_dbc_stop(dbc); /* remove sysfs files */ - sysfs_remove_group(&dbc->dev->kobj, &dbc_dev_attrib_grp); + sysfs_remove_groups(&dbc->dev->kobj, &dbc_dev_groups); kfree(dbc); } From patchwork Mon Oct 2 16:16:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 147517 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1719375vqb; Mon, 2 Oct 2023 15:11:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFauiXFArn1OOD3vLsPcm34tm4Twlm/0ecTI+Uqf4wcFEUf51bEuIcTTWEMZXVGZVE39peH X-Received: by 2002:a17:902:c401:b0:1bc:8c6c:217d with SMTP id k1-20020a170902c40100b001bc8c6c217dmr12847337plk.61.1696284683985; Mon, 02 Oct 2023 15:11:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696284683; cv=none; d=google.com; s=arc-20160816; b=VN+v4MWNAZzHG4NfBtD0135ct3GL66LSXoiy85X1UWej/WF0acdogQUD5KphOTufIk qfSpJou4TnvpRxoMDct9q0V1cGQMcdK1WV/z8JYjoPltyEqAk4DDHNKG4c49mV58vwm0 YIa2nzCf7kB4o+XhaiOPwYlHEL4zcSVxwnyvjmfNP0Vv3lCnBf+14IjHwvass3rItnKP y4dEH2inUDaeF0pjZr5GNwf2Hp6VluB9CwNL/Iajrgjw+d45Rq+V/quyo0VRTDKDBMPs Jw349pD5Tg5ySNDPAyl028D+tTCAG8+GtP04DRdJkeQi0KrKyDZv9n7ykIwk3Q2Mxt6N d7Xw== 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 :dkim-signature; bh=uM1204m1KIHZyaf/KG1BFVyLP4sMoTfcrkSvH1otg4A=; fh=YYrWResMAxfU+C17BdM7l/WUXXvK87rdz5rOaZ9UMD0=; b=NMkw3PHuWPl31gXWFA6MTdg0BYvw2mMnD3k0+zJ1JJaTVVwfPk+kkPCq6NnS33ZDqZ U5EEHyq6pLMPYfhnpPB0T3pdOUsPRKJZ3QsT1iCcsVjet+a2b2nP6wqFFRtiLLYrKwi0 3hJmMayoBX3aWoguGoySM767eyV+jwlmbkQSuISWGLIPm0aiSsmb1ULrWJ+lLSUEPZ72 DYwgtezPzAhBcLFFiUgLcGdJVyfBD6dUzADggNZmYLqJtpZqroS4hd0fSAki83sM9PIH oBczDRGyaYzMrDx9cmAIWGCU1fTLyJmlvtnRreHySsFMoRDHx7huRlr+uKGapjgUuw30 PJGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mpbI92o1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id n3-20020a170902e54300b001c613b5e778si22400974plf.557.2023.10.02.15.11.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 15:11:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mpbI92o1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 72C8F802FD34; Mon, 2 Oct 2023 09:19:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238324AbjJBQS4 (ORCPT + 18 others); Mon, 2 Oct 2023 12:18:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238267AbjJBQSy (ORCPT ); Mon, 2 Oct 2023 12:18:54 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5E549E; Mon, 2 Oct 2023 09:18:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696263530; x=1727799530; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XhexIisAVKWahtWglpDt4hA3GcZPi6mztI8CxfJXXLo=; b=mpbI92o1F0vBH6TzmoruAHDR9PjY1ZGFByAbN+5dPXQ11bv2RaE0SGyj wi5LXaNXPfyXval2Kl7GV2txNcfoS92aih0QqoqbmO8NKpmDgKaIzU+2t W9aBZH6UmJfVoy3uOStc4S38g6fSo4LI2Z13ehYiFGmHUs4XGLQQlNf8O kqzbok6OUBeZnNb1MXCfAHBFp26iOWuLlhRCqHFYyIglwEFww22pWraBq 2BfGInaf6PrI1Bon7NcTvZjKGU00UMCXfh5ddyGOIHuVYMUMKPcSW3lN/ P9971Q+hosupLLhyWuOLr5it2y7CshVFTL0wlN5D3rsI0k1k+enEOAdn2 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="362949514" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="362949514" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 09:16:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="816339774" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="816339774" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 02 Oct 2023 09:16:21 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 47CFD14AF; Mon, 2 Oct 2023 19:16:20 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mathias Nyman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mathias Nyman , Greg Kroah-Hartman Subject: [PATCH v1 05/10] xhci: dbc: Check for errors first in xhci_dbc_stop() Date: Mon, 2 Oct 2023 19:16:05 +0300 Message-Id: <20231002161610.2648818-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> References: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE autolearn=ham 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 02 Oct 2023 09:19:00 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778683408876964441 X-GMAIL-MSGID: 1778683408876964441 The usual patter is to check for errors and then continue if none. Apply that pattern to xhci_dbc_stop() code. Signed-off-by: Andy Shevchenko --- drivers/usb/host/xhci-dbgcap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c index 3c90410e9cde..d110eb5f1625 100644 --- a/drivers/usb/host/xhci-dbgcap.c +++ b/drivers/usb/host/xhci-dbgcap.c @@ -646,11 +646,11 @@ static void xhci_dbc_stop(struct xhci_dbc *dbc) spin_lock_irqsave(&dbc->lock, flags); ret = xhci_do_dbc_stop(dbc); spin_unlock_irqrestore(&dbc->lock, flags); + if (ret) + return; - if (!ret) { - xhci_dbc_mem_cleanup(dbc); - pm_runtime_put_sync(dbc->dev); /* note, was self.controller */ - } + xhci_dbc_mem_cleanup(dbc); + pm_runtime_put_sync(dbc->dev); /* note, was self.controller */ } static void From patchwork Mon Oct 2 16:16:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 147432 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1635714vqb; Mon, 2 Oct 2023 12:10:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE/rtLHPHUMO032czbKP+CkVTgsbZKzIlMWbc6P4GsSfsm9FEbwACXlpSvmQHzGQZ6FRmO7 X-Received: by 2002:a17:902:9a44:b0:1c7:251c:c250 with SMTP id x4-20020a1709029a4400b001c7251cc250mr11375909plv.25.1696273813033; Mon, 02 Oct 2023 12:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696273813; cv=none; d=google.com; s=arc-20160816; b=geP0I29J9jDg0kZSafT+CIBL0VDDU2lGfYa/SbkOz4ZPKK7w11nS+2PLDH5xMTvGXE Ls88ZpHJY+lr8gnzh8kbqu9OBQPNMV4HAEjaABKhDIUGI5fDKXjh/NALoWCim97bDwEw UXUvi0JHFlFwac/kTgkaI03fZC+aaQg6rJqGyQmOokgXb0AWS3ZAZndISRtsfN3YQ4rM j8XQvZTp9nsamOqdPXAV+jxXBVG2vBJUHqjmVaomf2MJF6tmx39Fw49mHR12KGkkoTdn 58J/5hFqBTOU2I4GsoBErtq1nHCaHiEk263urHR+ea4ulPWWtuW/CapHDuHDLtRVw6iC 46Vw== 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 :dkim-signature; bh=qAsMYlebkoyS4/5C30V0XQfF/0PtPzHAISkL781+MAc=; fh=YYrWResMAxfU+C17BdM7l/WUXXvK87rdz5rOaZ9UMD0=; b=EShfC9QWrqgQUJSqQRXKxvRG72U2cFl5ATiTgwX0chuUK0cRLi1FBTGTzYn+kXqyF2 9DS8rAQYZOCMeVP5EJOmhMQ7Eq9wxKwMq35MoStUtlbxfyv6Kgmd9sSpVcaEW/6yAXao VH/RSywybc1XH1yxiKwAK62Oc98MRm3Lg8EHcyE+Eqwx1djxPhP+7rt/z96Tn3zqyCNV FbwxKzsx+a6fnma33QXdUg0FMiZFdm68X1239sJ/Csg2zMiUqD2RHoMLcMS2DYs8Aqol YmmuhWLb/m/fbnJoOFQzZ8RpgaeBM+H7FHorTWXlAl7cSp6WDEzZubzBWSihon+J/6Tr x7yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="l7/7K5U/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id y15-20020a17090322cf00b001bb792749a2si30218038plg.146.2023.10.02.12.10.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 12:10:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="l7/7K5U/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id EA0108026619; Mon, 2 Oct 2023 09:19:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238393AbjJBQT2 (ORCPT + 18 others); Mon, 2 Oct 2023 12:19:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238455AbjJBQTZ (ORCPT ); Mon, 2 Oct 2023 12:19:25 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33F311A7; Mon, 2 Oct 2023 09:19:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696263554; x=1727799554; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FrSE8d9uGldutiXJrJfF6BIwxKeDJqqgKYwSnq784UY=; b=l7/7K5U/A7+Zzi6F+US7ak70dSKo74HDpKCIoCDfplnxdvsyIDpmIvOf eflvmkCkcNxVFuZmpIFXbJ4XTdKAlEfidqoDyhMc/PDTC02twT8a3lMNB ZtePDdbWVAiEZiRiViSDkGLHw4rlIxtOvQlinHNl9eYNJa2GpigVP0ibs 1gdnJFFRlQWq8knoG3eoBIZm9P/RFEHzDQQCYaPJ3hHq3lZaQP9N/UDtz 4pleQG3gu3ua/fiZ4J61T7bB61EBFzNhI6tBL1cRIM5m59sL30MDYlPE0 UWj2CeVj84nDN+rnQiXSFNdVxJH5tiVU0Su68r1OSZzM8NI7xHQAyf+UA g==; X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="382588658" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="382588658" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 09:16:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="841031516" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="841031516" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 02 Oct 2023 09:16:24 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5C2FE157E; Mon, 2 Oct 2023 19:16:20 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mathias Nyman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mathias Nyman , Greg Kroah-Hartman Subject: [PATCH v1 06/10] xhci: dbc: Don't shadow error codes in store() functions Date: Mon, 2 Oct 2023 19:16:06 +0300 Message-Id: <20231002161610.2648818-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> References: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 02 Oct 2023 09:19:52 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778672009734130045 X-GMAIL-MSGID: 1778672009734130045 kstrtox() along with regmap API can return different error codes based on the circumstances. Don't shadow them when returning to the caller. Signed-off-by: Andy Shevchenko --- drivers/usb/host/xhci-dbgcap.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c index d110eb5f1625..2332133c6581 100644 --- a/drivers/usb/host/xhci-dbgcap.c +++ b/drivers/usb/host/xhci-dbgcap.c @@ -978,9 +978,11 @@ static ssize_t dbc_idVendor_store(struct device *dev, void __iomem *ptr; u16 value; u32 dev_info; + int ret; - if (kstrtou16(buf, 0, &value)) - return -EINVAL; + ret = kstrtou16(buf, 0, &value); + if (ret) + return ret; xhci = hcd_to_xhci(dev_get_drvdata(dev)); dbc = xhci->dbc; @@ -1018,9 +1020,11 @@ static ssize_t dbc_idProduct_store(struct device *dev, void __iomem *ptr; u32 dev_info; u16 value; + int ret; - if (kstrtou16(buf, 0, &value)) - return -EINVAL; + ret = kstrtou16(buf, 0, &value); + if (ret) + return ret; xhci = hcd_to_xhci(dev_get_drvdata(dev)); dbc = xhci->dbc; @@ -1057,9 +1061,11 @@ static ssize_t dbc_bcdDevice_store(struct device *dev, void __iomem *ptr; u32 dev_info; u16 value; + int ret; - if (kstrtou16(buf, 0, &value)) - return -EINVAL; + ret = kstrtou16(buf, 0, &value); + if (ret) + return ret; xhci = hcd_to_xhci(dev_get_drvdata(dev)); dbc = xhci->dbc; @@ -1099,9 +1105,13 @@ static ssize_t dbc_bInterfaceProtocol_store(struct device *dev, u8 value; int ret; - /* bInterfaceProtocol is 8 bit, but xhci only supports values 0 and 1 */ + /* bInterfaceProtocol is 8 bit, but... */ ret = kstrtou8(buf, 0, &value); - if (ret || value > 1) + if (ret) + return ret; + + /* ...xhci only supports values 0 and 1 */ + if (value > 1) return -EINVAL; xhci = hcd_to_xhci(dev_get_drvdata(dev)); From patchwork Mon Oct 2 16:16:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 147439 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1650131vqb; Mon, 2 Oct 2023 12:38:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHsml0e6noHgbXuV9P2lQ8B5+l6/+I0t7i6ZpgxLXUSKf4C1RrNIraZmSvH0/UBWvRyeB8b X-Received: by 2002:a05:6808:23d4:b0:3ae:a753:a55d with SMTP id bq20-20020a05680823d400b003aea753a55dmr15731093oib.6.1696275514166; Mon, 02 Oct 2023 12:38:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696275514; cv=none; d=google.com; s=arc-20160816; b=sizqDGIs0byu/y/xqR+ilH5jULMlflbQqFFBb5cI2fW4T7/9F05GAOU842XmzxLEeV 0AN63kr5yNYg2nKljycJh+Pfd1sFKWhndd8icadNyqBSysZJ52EhEsycpyEc53mhYEsH a91mUg4tKjP5pCdt2wm7S34y4coCXxVOr1yScjiYdo4hJTlOWP3UYFg7dwbDNQR5AdS8 pLElXRApDAoF3AGCHiht4uhW3Ujf5IPghJRdjcL9DtsqksIQH0AEpyj6j/iEdALH8IKw nN/6Gml8R7r9NPPC3pQvgSVM7izL/toI0Ud+/rb8O7q5ixcsSSGRjcDMngvhG56ALYOt 2S4w== 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 :dkim-signature; bh=9RI8/ClTCeA7GwWQv1PA1m0Tr4pDJb8REiF/4qY/3Y0=; fh=YYrWResMAxfU+C17BdM7l/WUXXvK87rdz5rOaZ9UMD0=; b=SveLSsH8TpAJom4SZcUYUgtYsqrlVEwmT2rEJHkfXz9Aqucx8ZmlX4rnsCGHObNVY4 Iru1iill7rW7E/lShNx25ph8NwgIi5/imxZ+EsZBSftRWiAnqRcc7s6yhC16OxZpiOE0 fAC6sVbUOgl7UJ2G+jaoEwtMvYOW6iFHQZgzEMV5XQ7XFpASn6i1WkmhmJwUfyGiRJ/J F9L4zxuuJM6/W2XYluRT2OLilNfuKm4rK9A8pvr4o1BWjB7o/Gvm4s9VZpq2bKntoDN7 A6KooVJvOHx8Hadsa7mD3fVxJpNogBqdX+86fTwk499mts1n6UMQRLXmDVXDaRJKox34 Hvvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="WeMv0O/w"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id s123-20020a632c81000000b00573f76b1f75si27479297pgs.592.2023.10.02.12.38.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 12:38:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="WeMv0O/w"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 73B9E8118756; Mon, 2 Oct 2023 09:19:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238403AbjJBQTU (ORCPT + 18 others); Mon, 2 Oct 2023 12:19:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238390AbjJBQTR (ORCPT ); Mon, 2 Oct 2023 12:19:17 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E0D8CDE; Mon, 2 Oct 2023 09:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696263549; x=1727799549; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5q/ryLz/eJWv6HpUt5GYTqF30dvGM85K4SmBspi369M=; b=WeMv0O/wOILo+u+wWmbAWweKoGXVuIAvQ1/4uPIow4morT9Ttydha9ka atMEBrs220fhIp+kCOjRAb+/Y1pF2F++0IU0V54lfxnrK0aevlOsdJUMc GRGrr5o/SYFQKsThLm6k22WsF+aaJ6oL/RCH0mEuncsufL3XLQM1KfN8E KAa337IL3wVLq9aMZvgiEy6GhPNkT2/e99yicJ5+A564t7f2pgaeJhT+d FPWzfmPuGoJoh9MP2cJUVCeRH4tF403nVscm57LYID3fwVAY9HEfeUgBZ rNoIymHQuNOltoSnWKVSV7MTVGQUqDfHai0R27B8S2yn7zYHvXJfubR7Q g==; X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="382588661" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="382588661" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 09:16:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="841031518" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="841031518" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 02 Oct 2023 09:16:24 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6600614B3; Mon, 2 Oct 2023 19:16:20 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mathias Nyman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mathias Nyman , Greg Kroah-Hartman Subject: [PATCH v1 07/10] xhci: dbc: Replace custom return value with proper Linux error code Date: Mon, 2 Oct 2023 19:16:07 +0300 Message-Id: <20231002161610.2648818-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> References: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 02 Oct 2023 09:19:47 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778673793298568032 X-GMAIL-MSGID: 1778673793298568032 Replace the custom return value with proper Linux error code. Signed-off-by: Andy Shevchenko --- drivers/usb/host/xhci-dbgcap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c index 2332133c6581..617d057aa5f8 100644 --- a/drivers/usb/host/xhci-dbgcap.c +++ b/drivers/usb/host/xhci-dbgcap.c @@ -593,7 +593,7 @@ static int xhci_do_dbc_start(struct xhci_dbc *dbc) static int xhci_do_dbc_stop(struct xhci_dbc *dbc) { if (dbc->state == DS_DISABLED) - return -1; + return -EINVAL; writel(0, &dbc->regs->control); dbc->state = DS_DISABLED; From patchwork Mon Oct 2 16:16:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 147508 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1716677vqb; Mon, 2 Oct 2023 15:05:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEw1nmy2bMBkcgLfIj9fdVxhbsYmvbwCn053bMFJTdhtGR0mHsiIrswGxvlMsboUQ9EuNFM X-Received: by 2002:a05:6a21:182:b0:14c:5dc3:f1c9 with SMTP id le2-20020a056a21018200b0014c5dc3f1c9mr14527063pzb.49.1696284351057; Mon, 02 Oct 2023 15:05:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696284351; cv=none; d=google.com; s=arc-20160816; b=MMjeJXVQgforG72aV9bXSVE2jtl4JIHrpPVU4arsXX4j7Y9Fgo0CJwCtv1+/PqM+0i CIpxYWM1/7PzHb8zwQAN9mwfcAIXcQLzBrpkqt6gzw0os9P9AkTlvvrqgGA8UIeXGmSq VQEv/vSOj3VsVTn7G9kRVLdBoCIQK0/B0g040duvPd8ne7fw/XYgFALaXsrAZZ+xXHgj sLJgSX9TTRY9x4Vbtg1RMvXqDX4oiN1MIvWXnlqr0EBzdBlpY0phqwdD18guHG90IbgB 4206d4ZG6v9Jgeu+iOAKf/2sxEYuYqOau8LuQQAOMaBn9SpTd7jKKAhU8SGPc60gmR5q wd6A== 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 :dkim-signature; bh=+dFM3dQp7mzNJZpQDv8nvp+BwfB/hOpZXmDV7J0c5Dc=; fh=YYrWResMAxfU+C17BdM7l/WUXXvK87rdz5rOaZ9UMD0=; b=eAqDxrK+QiW3Ett6QrFRY0zNb/o+HtWekAiKdmiPAdjmeIqynuegBfGkqhurCpt2D0 QjlHnVjUvrxYFGvZhBrTKlEk16Z3Y/j0eZEpiWDGrQN75uwl0l2CSYBppFg+egzsGfjn GHGQRxa0uWQwu7SL8hmpFAs3h7m3jJkbguxl3HXHs2E7zq1IJt+X2M1+7xTzDZQxaRLN Ymu3PGw1Hz3VvoDDqYKhaL95j8801/0gmMPFhppKWAOwxkAzfsQ1PVNXjPY5zT5SLsqn GvH7q9GOdergJlYM6goNrZ7W6ufYbHaCtjR4RnJ/MD1nADtTcoCkU975mTxtFPXJImSn GQ9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cWsw52IE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id j6-20020a170902da8600b001c3c94d212fsi7328894plx.97.2023.10.02.15.05.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 15:05:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cWsw52IE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 0E87F80236FD; Mon, 2 Oct 2023 09:19:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238374AbjJBQTG (ORCPT + 18 others); Mon, 2 Oct 2023 12:19:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238316AbjJBQSz (ORCPT ); Mon, 2 Oct 2023 12:18:55 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0792BC4; Mon, 2 Oct 2023 09:18:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696263533; x=1727799533; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Kv1vxuF0jud+8jhw5JHU/tzaPQgxkHf1HRU7hzDONZc=; b=cWsw52IET/wE4wODSbhI5NS3NxwWOMFyvQNsHGpCZ/xHO6YmLjvES5Az SI0NLWHmkDNA/hF4VCza0BLhQ0SXbw5SgXyZMNGZkfUypbff6xRSMTQwj WSaTHyrjbL9nXfVqUHKTGuacaUqruordrEPMQDm+giYqK4cPfjOdKVahD lPHkU0+PDpIt3/rbP+KW4OAlAmjvY7+i3wOwzPc1/SqJ6wB/OpbBVHDz/ mATXAHQ5iiA09MAuEjDtQB/xLkW13mjrTbCLJeXlq2Tcg6CnAXacQzYkp cQOWfpn7xtrZ4ovcGCiJeHkCjwYt1sjaalS6nR0TA0qwjfUM5Hnbz1wrS g==; X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="362949546" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="362949546" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 09:16:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="816339812" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="816339812" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 02 Oct 2023 09:16:25 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 7551315BA; Mon, 2 Oct 2023 19:16:20 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mathias Nyman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mathias Nyman , Greg Kroah-Hartman Subject: [PATCH v1 08/10] xhci: dbc: Use sizeof_field() where it makes sense Date: Mon, 2 Oct 2023 19:16:08 +0300 Message-Id: <20231002161610.2648818-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> References: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE autolearn=ham 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 02 Oct 2023 09:19:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778683059684591719 X-GMAIL-MSGID: 1778683059684591719 Instead of doing custom calculations, use sizeof_field() macro. Signed-off-by: Andy Shevchenko --- drivers/usb/host/xhci-dbgcap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c index 617d057aa5f8..88e90c30916c 100644 --- a/drivers/usb/host/xhci-dbgcap.c +++ b/drivers/usb/host/xhci-dbgcap.c @@ -374,7 +374,7 @@ static void xhci_dbc_eps_init(struct xhci_dbc *dbc) static void xhci_dbc_eps_exit(struct xhci_dbc *dbc) { - memset(dbc->eps, 0, sizeof(struct dbc_ep) * ARRAY_SIZE(dbc->eps)); + memset(dbc->eps, 0, sizeof_field(struct xhci_dbc, eps)); } static int dbc_erst_alloc(struct device *dev, struct xhci_ring *evt_ring, From patchwork Mon Oct 2 16:16:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 147466 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1681229vqb; Mon, 2 Oct 2023 13:46:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjWu+VfBBvWpDWES//cdo3YbFyVtom1Xl8mj1p5n36BSWn/XQanZsMiTas6DcIv2zcw0iM X-Received: by 2002:a17:903:230b:b0:1c3:4565:22f with SMTP id d11-20020a170903230b00b001c34565022fmr14826570plh.21.1696279561898; Mon, 02 Oct 2023 13:46:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696279561; cv=none; d=google.com; s=arc-20160816; b=ur78vzmhv8YVvsQQ77OHhTTQn8YSwMazDJ5xSLOv/mV8dfijSMbrxWM8WONRKOR40s fvUOmqoeWzzZQtmm1yKqsJdKbrk2te3OFuNKVYP2woio25odv0mFso0SmDX4HCZWpMci mTbe63OxvEhto6UucQM0K3h2ZoIZYUpvT9cN9V3tVoU2zO5cHzQR/oWC65tM+CjJriFg pgRB23Kf8rtEg1ijtMmQg+g53Q+x/TPl/ATEMrHW+cxZExSdhZ/IEIxobKOATNm6Rsl6 JCRT29iJi2UhL01yG75/ySo7LlJpe0CVhqy6PhU2DIwCVxUIsKNepzNGgH9hc5+LC8Nh PChw== 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 :dkim-signature; bh=fGIl/8HgEQEMRTmBqwI2Yr03LmtWrOzboMelUxhw1C4=; fh=YYrWResMAxfU+C17BdM7l/WUXXvK87rdz5rOaZ9UMD0=; b=1LqRoajnzCYjn0KTgCfAgTDO6BW8IbxjscHFCYTEyYEgGN+aoq+PfUhyyGg9M6cr4v o3mLyQrxeAb5ecoYTsefaRHX+LFldu9WXKCh28qZJ7Ooejs1ISergeWYWmElzAnTK9RR tzjHwHXSwMkYw6M/GTWMx3C877Zx96AA7GuzUd7nVCzKEBkdMDisIZ+LmAipuggPYyNL tHK7Drf4wCGCkxPgGgqOjLWuFLi77R7ZED+YeNcC0acGadYh1EJXA1SKgQMSxbrEqpEI gF1anTCYn7GMDIv2jCqjiebkecl/0vVkq2e400PyFeLkN8u6aZbqK8A1AM5ZVm8w1M6/ CEXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Sca32JuC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id t4-20020a17090340c400b001bc434b9d95si28022079pld.156.2023.10.02.13.46.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 13:46:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Sca32JuC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id EEA45806B066; Mon, 2 Oct 2023 09:20:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238444AbjJBQTb (ORCPT + 18 others); Mon, 2 Oct 2023 12:19:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238407AbjJBQTZ (ORCPT ); Mon, 2 Oct 2023 12:19:25 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A38F91B2; Mon, 2 Oct 2023 09:19:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696263554; x=1727799554; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XIwDvhcLk2v02GLDwaCD9wqDMTdN2dYVtBOJfYJ9NN4=; b=Sca32JuCzuVJWhJO5+Kezum95O6TMAQrdKTUuiTlZ5nL8833nplxOEQw Q1BjnbentWUDyObz98qjfRkgG381BIfr4v+EUsE5uGWyDUgCwzdVzdqoO 7eXe8g/I2epAha8oRY7MqPSsHt4RyUSKYTZ/1AJkvc/UNnS2u0OAPKlYY p7oVyE19SjBpxKh8rxwa41sj+/5ZeRd7Ijk4vtHm9QY6g+6HR1FCYPj0i sRPLdkGxmh+W+Hv8sasSwbLAWonWSAtBEDVJFvGeboj6QBFGGlapP9YAw O896hfnDImev1O8e9J8Ejsf/BcVvke4J8c3zAMeu9uAjrF4tkKl9pWKSB g==; X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="382588666" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="382588666" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 09:16:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="841031520" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="841031520" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 02 Oct 2023 09:16:25 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 7AB291593; Mon, 2 Oct 2023 19:16:20 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mathias Nyman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mathias Nyman , Greg Kroah-Hartman Subject: [PATCH v1 09/10] xhci: dbc: Use sizeof(*pointer) instead of sizeof(type) Date: Mon, 2 Oct 2023 19:16:09 +0300 Message-Id: <20231002161610.2648818-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> References: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 02 Oct 2023 09:20:24 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778678038034223874 X-GMAIL-MSGID: 1778678038034223874 It is preferred to use sizeof(*pointer) instead of sizeof(type). The type of the variable can change and one needs not change the former (unlike the latter). No functional change intended. Signed-off-by: Andy Shevchenko --- drivers/usb/host/xhci-dbgcap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c index 88e90c30916c..366ce3146a93 100644 --- a/drivers/usb/host/xhci-dbgcap.c +++ b/drivers/usb/host/xhci-dbgcap.c @@ -380,7 +380,7 @@ static void xhci_dbc_eps_exit(struct xhci_dbc *dbc) static int dbc_erst_alloc(struct device *dev, struct xhci_ring *evt_ring, struct xhci_erst *erst, gfp_t flags) { - erst->entries = dma_alloc_coherent(dev, sizeof(struct xhci_erst_entry), + erst->entries = dma_alloc_coherent(dev, sizeof(*erst->entries), &erst->erst_dma_addr, flags); if (!erst->entries) return -ENOMEM; @@ -394,7 +394,7 @@ static int dbc_erst_alloc(struct device *dev, struct xhci_ring *evt_ring, static void dbc_erst_free(struct device *dev, struct xhci_erst *erst) { - dma_free_coherent(dev, sizeof(struct xhci_erst_entry), erst->entries, + dma_free_coherent(dev, sizeof(*erst->entries), erst->entries, erst->erst_dma_addr); erst->entries = NULL; } @@ -494,7 +494,7 @@ static int xhci_dbc_mem_init(struct xhci_dbc *dbc, gfp_t flags) goto ctx_fail; /* Allocate the string table: */ - dbc->string_size = sizeof(struct dbc_str_descs); + dbc->string_size = sizeof(*dbc->string); dbc->string = dma_alloc_coherent(dev, dbc->string_size, &dbc->string_dma, flags); if (!dbc->string) From patchwork Mon Oct 2 16:16:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 147545 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1731100vqb; Mon, 2 Oct 2023 15:40:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFRbWeFxA792WbUoS/O6HuV6vz8dtWc6aD57MJzQq/mGdYg3mPv8PJ+7Apql4Nbm+2yBDcb X-Received: by 2002:a05:6a00:24c5:b0:68f:dcc1:4bef with SMTP id d5-20020a056a0024c500b0068fdcc14befmr17750788pfv.7.1696286423232; Mon, 02 Oct 2023 15:40:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696286423; cv=none; d=google.com; s=arc-20160816; b=efR9EEatMvjmm5pV2H50z/Igkf+uRBKaUtixl+lfK3A2PxBVY4QHznCRd+5jRD+r8x 0cRLBYeX4UTVujAaDu7CGPzax08MILyBViimN+/9wAUw/AM2q674mJ5GA1IiQVMxOtvB oQPGdVqtVQ8uQEkvEzChihAo+/xkO9oCweBkd8qMX/CZNWA5RCHXK8nuzT3Ics7rzCVQ YhRRWz1u+0rL27dX9wVNeItsSB/ynE15S51dtLCRWdlw4QvzhU9ZcdGtVbLc5RJ50nQl pfdOrkAQDwIBK4cFJ5aRMSldZ9aSyfs5vmT16q/v8cVSlOHx5uvbzeELIPP5CYHZc3BF KDiw== 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 :dkim-signature; bh=gWm/wN0VVCotVBOJ0BuauodkdDtEe8fnhv4XdJqlY1M=; fh=YYrWResMAxfU+C17BdM7l/WUXXvK87rdz5rOaZ9UMD0=; b=VynVP7Xn1bQl557UQqHXr7zq7+0JDEvOJJlx7vdeEFtpYW0mxXXfp7svRjPxyvcXAL An3jTkEbbEwGFJCfDmvDTeTb5dC1a4BwY/mkTDXdwE9wwCvZgHvDwDWxVsqWkw0YfG6K uElNYftb3UFCLpzituB1YUrb9zJQE/vYHzaB2E20HzetiNgC8PMZYV1ohfbPUJOOSdUx 6EcXJopH1He90gFQZ0VIkmUZtQOuwSJBTKHyJm3NzfrDskl2DxStc1f3jmIdqQA6Kb02 Y9EVIirhD36cx95TnY+IWdDt2HFjaPSuLOEE7YhaT6GFZ4r2dVnxZPw+5Aan45E4Zs7B djpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=B2tePY5g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id c10-20020a056a00248a00b0068fa57d2442si5351pfv.130.2023.10.02.15.40.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 15:40:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=B2tePY5g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 1A050802A6D0; Mon, 2 Oct 2023 09:19:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238402AbjJBQTA (ORCPT + 18 others); Mon, 2 Oct 2023 12:19:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238300AbjJBQSz (ORCPT ); Mon, 2 Oct 2023 12:18:55 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1EEEBD; Mon, 2 Oct 2023 09:18:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696263532; x=1727799532; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=25mC9ayhiVvOyhyLLT89N3/FQzoVtawylvAn3pXdF80=; b=B2tePY5g5C67WekeQ/1V1wRaQ47IXSbbc9IY3mnpJhNrS+nFjq+TQ4s4 JDZ4F0HxZl0bo7pUN7vaVgPTK0YSMqOvmMLt3Hwbxnu8TYqo4KwG8DhcE CliNe6IKjsRMGSqqU5Rese7HF/kRIMCzO3KeG0eATUekY6FIX3Zcdp73k 7TzWAjPlDYhKb99oL8rcbPwvGF5h7+PTEK/mKtvo3E0MDNSoYfusXREjb z4d2Rx1iK39mvgA58acXnJ9vuU2FBhdk0KwwZgkiy+LxW71NCtdqBphU9 4CKPM1rWhYZ7IzZhnCkRXzQ9aoKKf0J2jS72LeEvuFmLFvncOl2CzN+yj A==; X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="362949543" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="362949543" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 09:16:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="816339811" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="816339811" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 02 Oct 2023 09:16:25 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 898081665; Mon, 2 Oct 2023 19:16:20 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mathias Nyman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mathias Nyman , Greg Kroah-Hartman Subject: [PATCH v1 10/10] xhci: dbc: Add missing headers Date: Mon, 2 Oct 2023 19:16:10 +0300 Message-Id: <20231002161610.2648818-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> References: <20231002161610.2648818-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE autolearn=ham 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 02 Oct 2023 09:19:08 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778685232822225718 X-GMAIL-MSGID: 1778685232822225718 Don't inherit headers "by chances" from asm/bug.h, asm/io.h, etc... Include the needed headers explicitly. Signed-off-by: Andy Shevchenko --- drivers/usb/host/xhci-dbgcap.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c index 366ce3146a93..eb2e89bf31be 100644 --- a/drivers/usb/host/xhci-dbgcap.c +++ b/drivers/usb/host/xhci-dbgcap.c @@ -6,9 +6,24 @@ * * Author: Lu Baolu */ +#include #include -#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include #include "xhci.h" #include "xhci-trace.h"