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: 728697 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B7EA1DA4A for ; Mon, 2 Oct 2023 16:18:54 +0000 (UTC) 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> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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: 728698 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE0071DA34 for ; Mon, 2 Oct 2023 16:18:52 +0000 (UTC) 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> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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: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: 728695 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 667E51DA36 for ; Mon, 2 Oct 2023 16:19:16 +0000 (UTC) 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> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 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: 728696 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C79D61A711 for ; Mon, 2 Oct 2023 16:18:54 +0000 (UTC) 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> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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: 728694 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 365591DA36 for ; Mon, 2 Oct 2023 16:19:24 +0000 (UTC) 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> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 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)