lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b34176d5-532a-4aca-a8e2-69c32fe996c1@intel.com>
Date: Thu, 13 Mar 2025 15:32:42 -0700
From: Jacob Keller <jacob.e.keller@...el.com>
To: Philipp Stanner <phasta@...nel.org>, Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, "Maxime
 Coquelin" <mcoquelin.stm32@...il.com>, Alexandre Torgue
	<alexandre.torgue@...s.st.com>, Yanteng Si <si.yanteng@...ux.dev>, "Huacai
 Chen" <chenhuacai@...nel.org>, Yinggang Gu <guyinggang@...ngson.cn>, "Serge
 Semin" <fancer.lancer@...il.com>, Philipp Stanner <pstanner@...hat.com>
CC: <netdev@...r.kernel.org>, <linux-stm32@...md-mailman.stormreply.com>,
	<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
	Andrew Lunn <andrew@...n.ch>, Huacai Chen <chenhuacai@...ngson.cn>, "Henry
 Chen" <chenx97@...c.io>
Subject: Re: [PATCH net-next 1/3] stmmac: loongson: Remove surplus loop



On 3/13/2025 9:14 AM, Philipp Stanner wrote:
> loongson_dwmac_probe() contains a loop which doesn't have an effect,
> because it tries to call pcim_iomap_regions() with the same parameters
> several times. The break statement at the loop's end furthermore ensures
> that the loop only runs once anyways.
> 
> Remove the surplus loop.
> 
> Signed-off-by: Philipp Stanner <phasta@...nel.org>
> Reviewed-by: Andrew Lunn <andrew@...n.ch>
> Reviewed-by: Yanteng Si <si.yanteng@...ux.dev>
> Reviewed-by: Huacai Chen <chenhuacai@...ngson.cn>
> Tested-by: Henry Chen <chenx97@...c.io>
> ---
>  .../net/ethernet/stmicro/stmmac/dwmac-loongson.c    | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> index 73a6715a93e6..e2959ac5c1ca 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> @@ -524,7 +524,7 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
>  	struct stmmac_pci_info *info;
>  	struct stmmac_resources res;
>  	struct loongson_data *ld;
> -	int ret, i;
> +	int ret;
>  
>  	plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
>  	if (!plat)
> @@ -554,14 +554,9 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
>  	pci_set_master(pdev);
>  
>  	/* Get the base address of device */
> -	for (i = 0; i < PCI_STD_NUM_BARS; i++) {
> -		if (pci_resource_len(pdev, i) == 0)
> -			continue;
> -		ret = pcim_iomap_regions(pdev, BIT(0), DRIVER_NAME);
> -		if (ret)
> -			goto err_disable_device;
> -		break;
> -	}

This nonsensical code has been here since the beginning of the Loongson
support in commit 30bba69d7db4 ("stmmac: pci: Add dwmac support for
Loongson")

Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ