From patchwork Mon Oct 16 13:09:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 153387 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3449386vqb; Mon, 16 Oct 2023 06:11:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9JSlbtNXbCsgZiz6OhHS5xN3CSPYfk6Fe6xTYTKbBW1MQfV7FUkSi/mzcf3/x1rhVKJZO X-Received: by 2002:a05:6a20:7d85:b0:163:57ba:2ad4 with SMTP id v5-20020a056a207d8500b0016357ba2ad4mr40294744pzj.2.1697461872992; Mon, 16 Oct 2023 06:11:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697461872; cv=none; d=google.com; s=arc-20160816; b=B5ZxEoSNwTiejFRAJz3Rk+5kgwFCKB5x4l9UyEc5aja3Ofzj9o+Ivk4flmsnIz2R2+ yhXtNxnH8kvYiXZ4xrnSWHIV9F6E8aZWiPeMqA/sJgT2nyh2DFpIsau4Wq4RhckSWUPZ VSd91SxVbSPZP/tdQnV4RG2CIFql/uyt6eaXj8YfCkXWFMxehNE9Q0d/XaXVeWRVHxTD bPgJgyQcvAHa5UQnrFvI4pTfClL98wBgtZfBYg0Xhn4JhaP7qpfrpnZcEJe7SDyPt1DU /UYh0PuxKzNxCaTu+YWXI4jq7hWrEtO5f2iSNQemk6XSUO4+mLmTqQJCi2eQqxGEnp1e G4cQ== 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=8yy3hLeRFCiFZhwewQmcU2ZY7qa3cgCNLrOpWfOyynA=; fh=YYrWResMAxfU+C17BdM7l/WUXXvK87rdz5rOaZ9UMD0=; b=z9jWX1H1ogxCHxO89JKJYbsVQcnmsyiWbD1KgHUwly9KR4uVj31nEOyMOvtmdNs0hR tLXItX9+8+hA7yFnHrHlfazLYddxzC20+ey30wqpCQjPP66Uv35v4XiVN1OFMtqfkSEV s6mmFRzqqpp40PY33JLiCNgxhcNx/PhtlsGxiAZlPFyJ6W8iWgsjolKV6i5vH/tBdmK/ 9+NgkyfE6GaXFGGEFoVirt1jp+Y0NOL3ms5M6fI3n2kHlVufkoiuAQC6xfgYCwY/n2KT iW0/vsMsZQjzIPd9pg8p+7FofVZEykJo/Jg4Dw9l3QxpmE7utR5Cq9bBb5/xZ6Vnhq8E 87YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=a2FAnSit; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id s23-20020a632c17000000b005adec857fd3si6634605pgs.523.2023.10.16.06.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 06:11:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=a2FAnSit; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 5F327808E0FF; Mon, 16 Oct 2023 06:10:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233687AbjJPNJ7 (ORCPT + 18 others); Mon, 16 Oct 2023 09:09:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233562AbjJPNJu (ORCPT ); Mon, 16 Oct 2023 09:09:50 -0400 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A00A2AB; Mon, 16 Oct 2023 06:09: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=1697461789; x=1728997789; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wKIv3sJ1clYjdqjwiVvVRD9CCUCGlQHTF5I50Li2+CE=; b=a2FAnSity9U8+c9YPI7bdJ8uLCLCXe9/UnhpW0UjY9plAN/HrJlhGPdR AWgiEEIm/CItmeySEuzovep/ij2jObaf2+BO2iYmA0R41GPvrsisvBMpY RUP6RrkyysYaHS20UVqyAxWqHr3c6X38KrrVQv2KP1IiEAvkFc2SfJ9vM cDNKXNjOyQhFb3KrIhg99SCW9Nk+KDuDy+c1guJ9BhsJMVd5wuFSXo0LM sNrk2C9svR3nwl7Je/fn/VQM2jqVYMwhSA8x4YUtbj3EHSOXfEccFoj68 e8V0p5LCf3GZs1j5narvFUEypIkHR7wW67X6WbjrfkTvM8njGZVwZ6OdT w==; X-IronPort-AV: E=McAfee;i="6600,9927,10863"; a="4133288" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="4133288" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 06:09:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10863"; a="1087067131" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="1087067131" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 16 Oct 2023 06:09:41 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0707F11D; Mon, 16 Oct 2023 16:09:41 +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 v2 01/10] xhci: dbc: Drop duplicate checks for dma_free_coherent() Date: Mon, 16 Oct 2023 16:09:25 +0300 Message-Id: <20231016130934.1158504-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20231016130934.1158504-1-andriy.shevchenko@linux.intel.com> References: <20231016130934.1158504-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 howler.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 (howler.vger.email [0.0.0.0]); Mon, 16 Oct 2023 06:10:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779917780635238987 X-GMAIL-MSGID: 1779917780635238987 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;