All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] PCI: apple: Remove redundant initialization of pointer port_pdev
@ 2021-10-12 13:32 Colin King
  2021-10-12 15:02 ` Alyssa Rosenzweig
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Colin King @ 2021-10-12 13:32 UTC (permalink / raw)
  To: Alyssa Rosenzweig, Marc Zyngier, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczyński, Bjorn Helgaas, linux-pci
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

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 <colin.king@canonical.com>
---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH][next] PCI: apple: Remove redundant initialization of pointer port_pdev
  2021-10-12 13:32 [PATCH][next] PCI: apple: Remove redundant initialization of pointer port_pdev Colin King
@ 2021-10-12 15:02 ` Alyssa Rosenzweig
  2021-10-13  0:47 ` Krzysztof Wilczyński
  2021-10-13 13:41 ` Lorenzo Pieralisi
  2 siblings, 0 replies; 7+ messages in thread
From: Alyssa Rosenzweig @ 2021-10-12 15:02 UTC (permalink / raw)
  To: Colin King
  Cc: Marc Zyngier, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczyński, Bjorn Helgaas, linux-pci,
	kernel-janitors, linux-kernel

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 <colin.king@canonical.com>
> 
> 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 <colin.king@canonical.com>
> ---
>  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
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][next] PCI: apple: Remove redundant initialization of pointer port_pdev
  2021-10-12 13:32 [PATCH][next] PCI: apple: Remove redundant initialization of pointer port_pdev Colin King
  2021-10-12 15:02 ` Alyssa Rosenzweig
@ 2021-10-13  0:47 ` Krzysztof Wilczyński
  2021-10-13 13:41 ` Lorenzo Pieralisi
  2 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Wilczyński @ 2021-10-13  0:47 UTC (permalink / raw)
  To: Colin King
  Cc: Alyssa Rosenzweig, Marc Zyngier, Lorenzo Pieralisi, Rob Herring,
	Bjorn Helgaas, linux-pci, kernel-janitors, linux-kernel

Hi Colin!

> 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 <colin.king@canonical.com>
> ---
>  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;

Thank you!

Reviewed-by: Krzysztof Wilczyński <kw@linux.com>

	Krzysztof

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][next] PCI: apple: Remove redundant initialization of pointer port_pdev
  2021-10-12 13:32 [PATCH][next] PCI: apple: Remove redundant initialization of pointer port_pdev Colin King
  2021-10-12 15:02 ` Alyssa Rosenzweig
  2021-10-13  0:47 ` Krzysztof Wilczyński
@ 2021-10-13 13:41 ` Lorenzo Pieralisi
  2021-10-13 14:06   ` Alyssa Rosenzweig
  2021-10-13 14:22   ` Colin Ian King
  2 siblings, 2 replies; 7+ messages in thread
From: Lorenzo Pieralisi @ 2021-10-13 13:41 UTC (permalink / raw)
  To: Colin King
  Cc: Alyssa Rosenzweig, Marc Zyngier, Rob Herring,
	Krzysztof Wilczyński, Bjorn Helgaas, linux-pci,
	kernel-janitors, linux-kernel

On Tue, Oct 12, 2021 at 02:32:35PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> 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 <colin.king@canonical.com>
> ---
>  drivers/pci/controller/pcie-apple.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Squashed into the commit it is fixing.

Thanks !
Lorenzo

> 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
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][next] PCI: apple: Remove redundant initialization of pointer port_pdev
  2021-10-13 13:41 ` Lorenzo Pieralisi
@ 2021-10-13 14:06   ` Alyssa Rosenzweig
  2021-10-13 14:14     ` Lorenzo Pieralisi
  2021-10-13 14:22   ` Colin Ian King
  1 sibling, 1 reply; 7+ messages in thread
From: Alyssa Rosenzweig @ 2021-10-13 14:06 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: Colin King, Marc Zyngier, Rob Herring, Krzysztof Wilczyński,
	Bjorn Helgaas, linux-pci, kernel-janitors, linux-kernel

Hi Lorenzo,

> > 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 <colin.king@canonical.com>
> > ---
> >  drivers/pci/controller/pcie-apple.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Squashed into the commit it is fixing.

It seems the commit already landed in linux-next? [1]

[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=00723f494020aceb92f789af634fecba1477fc01

Alyssa

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][next] PCI: apple: Remove redundant initialization of pointer port_pdev
  2021-10-13 14:06   ` Alyssa Rosenzweig
@ 2021-10-13 14:14     ` Lorenzo Pieralisi
  0 siblings, 0 replies; 7+ messages in thread
From: Lorenzo Pieralisi @ 2021-10-13 14:14 UTC (permalink / raw)
  To: Alyssa Rosenzweig
  Cc: Colin King, Marc Zyngier, Rob Herring, Krzysztof Wilczyński,
	Bjorn Helgaas, linux-pci, kernel-janitors, linux-kernel

On Wed, Oct 13, 2021 at 10:06:20AM -0400, Alyssa Rosenzweig wrote:
> Hi Lorenzo,
> 
> > > 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 <colin.king@canonical.com>
> > > ---
> > >  drivers/pci/controller/pcie-apple.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > Squashed into the commit it is fixing.
> 
> It seems the commit already landed in linux-next? [1]
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=00723f494020aceb92f789af634fecba1477fc01

I know thanks. The updated one will land in next shortly.

Lorenzo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH][next] PCI: apple: Remove redundant initialization of pointer port_pdev
  2021-10-13 13:41 ` Lorenzo Pieralisi
  2021-10-13 14:06   ` Alyssa Rosenzweig
@ 2021-10-13 14:22   ` Colin Ian King
  1 sibling, 0 replies; 7+ messages in thread
From: Colin Ian King @ 2021-10-13 14:22 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: Alyssa Rosenzweig, Marc Zyngier, Rob Herring,
	Krzysztof Wilczyński, Bjorn Helgaas, linux-pci,
	kernel-janitors, linux-kernel

On 13/10/2021 14:41, Lorenzo Pieralisi wrote:
> On Tue, Oct 12, 2021 at 02:32:35PM +0100, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> 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 <colin.king@canonical.com>
>> ---
>>   drivers/pci/controller/pcie-apple.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Squashed into the commit it is fixing.
> 

Thanks. Much appreciated.

> Thanks !
> Lorenzo
> 
>> 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
>>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-10-13 14:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12 13:32 [PATCH][next] PCI: apple: Remove redundant initialization of pointer port_pdev Colin King
2021-10-12 15:02 ` Alyssa Rosenzweig
2021-10-13  0:47 ` Krzysztof Wilczyński
2021-10-13 13:41 ` Lorenzo Pieralisi
2021-10-13 14:06   ` Alyssa Rosenzweig
2021-10-13 14:14     ` Lorenzo Pieralisi
2021-10-13 14:22   ` Colin Ian King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.