Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2510666pxb; Tue, 12 Oct 2021 08:06:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNm9Wd3hcZT9OhdTKoMayuQVODjloX+n+aBNUITI4r6NN/ojaiVhlBbRuqeCXblwvLaq4q X-Received: by 2002:a17:902:e984:b0:13f:17c2:8f0a with SMTP id f4-20020a170902e98400b0013f17c28f0amr23465936plb.74.1634051171890; Tue, 12 Oct 2021 08:06:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634051171; cv=none; d=google.com; s=arc-20160816; b=SAfdRCFGjrvEo3/MrzcgaOK108siIeV60FzFDMWJI8tyAGu8KxiMXqGUT2Nchp2inC tL6kgzyRjNF3Muz507NqMfQQBTlqkCZ2iqlouK2ZTsJhOsWIdoF/2sA8waSIhekwFkpx F9ZgI4WyaORihSElrynKl/QLc8sMQqK6Hn9+RGUQm6YwplGEghLrhvXObkfDVgD5YbQ3 P1YniqXTaff0AbEoU7rFMWm45IVPqAZLn+ylZLCOVUiEXVyeEXd74lTLpxuF6rULn5fj fFAs/IUxc6eUc6yr/ha2kLTZBvFFsXSo02Qa5ghZoi7Qkpkzlp8a1KUkKd/P1+bqy3+z 8Lsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=ZM9eQg2026zqpJqB3IOfTt2sC8iwZD3RbFXldsAW1i4=; b=fPIReQQYZnbua3I2YNl6NAWEksoHmjFUFQYFCpPMXW8tv8ycQkjvWRgQFqAzUuRSMm mxuFwYsU3oN/ZqZMN0xyW0WIpIczIKIaA9ctN61tkdUWjnSin851340OSk/tRLJJ459j nLlwbFuFHO7vovH0s/DtASCFpijU8BC45i/ag5aolR6UY1ipZ6H/Y9kUWLNc55T2XjqN 9P6efWZXApSnujxp4ZFTa0M9jbwUXZb3/4K32OgbdQdtXhKGgqn31cg2U+kXxDSqZJdR 3JeF3ycHRuUzzb22efByN2M12ip+FC/Oo3osXeyOcC4jOe4wtZ7QinBb+RJINZqmM/Dn 6Tgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m18si208268pgl.218.2021.10.12.08.05.50; Tue, 12 Oct 2021 08:06:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237248AbhJLPE3 (ORCPT + 99 others); Tue, 12 Oct 2021 11:04:29 -0400 Received: from rosenzweig.io ([138.197.143.207]:46918 "EHLO rosenzweig.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbhJLPE2 (ORCPT ); Tue, 12 Oct 2021 11:04:28 -0400 Date: Tue, 12 Oct 2021 11:02:20 -0400 From: Alyssa Rosenzweig To: Colin King Cc: Marc Zyngier , Lorenzo Pieralisi , Rob Herring , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , linux-pci@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] PCI: apple: Remove redundant initialization of pointer port_pdev Message-ID: References: <20211012133235.260534-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211012133235.260534-1-colin.king@canonical.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It looks like port_pdev = pcie_find_root_port(pdev); might've meant to read port_pdev = pcie_find_root_port(port_pdev); in which case the assignment would be used. I have no strong opinions either way. Full context for those following along at home: ``` static struct apple_pcie_port *apple_pcie_get_port(struct pci_dev *pdev) { struct pci_config_window *cfg = pdev->sysdata; struct apple_pcie *pcie = cfg->priv; struct pci_dev *port_pdev = pdev; struct apple_pcie_port *port; /* Find the root port this device is on */ port_pdev = pcie_find_root_port(pdev); /* If finding the port itself, nothing to do */ if (WARN_ON(!port_pdev) || pdev == port_pdev) return NULL; list_for_each_entry(port, &pcie->ports, entry) { if (port->idx == PCI_SLOT(port_pdev->devfn)) return port; } return NULL; } ``` On Tue, Oct 12, 2021 at 02:32:35PM +0100, Colin King wrote: > From: Colin Ian King > > The pointer port_pdev is being initialized with a value that is never > read, it is being updated later on. The assignment is redundant and > can be removed. > > Addresses-Coverity: ("Unused value") > Signed-off-by: Colin Ian King > --- > drivers/pci/controller/pcie-apple.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c > index b4db7a065553..19fd2d38aaab 100644 > --- a/drivers/pci/controller/pcie-apple.c > +++ b/drivers/pci/controller/pcie-apple.c > @@ -634,7 +634,7 @@ static struct apple_pcie_port *apple_pcie_get_port(struct pci_dev *pdev) > { > struct pci_config_window *cfg = pdev->sysdata; > struct apple_pcie *pcie = cfg->priv; > - struct pci_dev *port_pdev = pdev; > + struct pci_dev *port_pdev; > struct apple_pcie_port *port; > > /* Find the root port this device is on */ > -- > 2.32.0 >