netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: stmmac: tegra: Properly allocate clock bulk data
@ 2023-07-26 16:32 Thierry Reding
  2023-07-27 11:49 ` Simon Horman
  2023-07-29 16:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Thierry Reding @ 2023-07-26 16:32 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Jon Hunter, netdev, linux-tegra

From: Thierry Reding <treding@nvidia.com>

The clock data is an array of struct clk_bulk_data, so make sure to
allocate enough memory.

Fixes: d8ca113724e7 ("net: stmmac: tegra: Add MGBE support")
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c
index 99e2e5a5cd60..78a492b91bc6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c
@@ -234,7 +234,8 @@ static int tegra_mgbe_probe(struct platform_device *pdev)
 	res.addr = mgbe->regs;
 	res.irq = irq;
 
-	mgbe->clks = devm_kzalloc(&pdev->dev, sizeof(*mgbe->clks), GFP_KERNEL);
+	mgbe->clks = devm_kcalloc(&pdev->dev, ARRAY_SIZE(mgbe_clks),
+				  sizeof(*mgbe->clks), GFP_KERNEL);
 	if (!mgbe->clks)
 		return -ENOMEM;
 
-- 
2.41.0


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

* Re: [PATCH] net: stmmac: tegra: Properly allocate clock bulk data
  2023-07-26 16:32 [PATCH] net: stmmac: tegra: Properly allocate clock bulk data Thierry Reding
@ 2023-07-27 11:49 ` Simon Horman
  2023-07-29 16:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-07-27 11:49 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Jon Hunter, Revanth Kumar Uppala, Bhadram Varka, Maxime Coquelin,
	netdev, linux-tegra, linux-arm-kernel, linux-stm32

On Wed, Jul 26, 2023 at 06:32:00PM +0200, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>

+  Revanth Kumar Uppala <ruppala@nvidia.com>,
   Bhadram Varka <vbhadram@nvidia.com>,
   Maxime Coquelin <mcoquelin.stm32@gmail.com>,
   linux-arm-kernel@lists.infradead.org,
   linux-stm32@st-md-mailman.stormreply.com

   As per the output of
   ./scripts/get_maintainer.pl --git-min-percent 25 this.patch
   which is the preferred method to determine the CC list for
   Networking patches.

> The clock data is an array of struct clk_bulk_data, so make sure to
> allocate enough memory.
> 
> Fixes: d8ca113724e7 ("net: stmmac: tegra: Add MGBE support")
> Signed-off-by: Thierry Reding <treding@nvidia.com>

Reviewed-by: Simon Horman <simon.horman@corigine.com>

> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c
> index 99e2e5a5cd60..78a492b91bc6 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-tegra.c
> @@ -234,7 +234,8 @@ static int tegra_mgbe_probe(struct platform_device *pdev)
>  	res.addr = mgbe->regs;
>  	res.irq = irq;
>  
> -	mgbe->clks = devm_kzalloc(&pdev->dev, sizeof(*mgbe->clks), GFP_KERNEL);
> +	mgbe->clks = devm_kcalloc(&pdev->dev, ARRAY_SIZE(mgbe_clks),
> +				  sizeof(*mgbe->clks), GFP_KERNEL);
>  	if (!mgbe->clks)
>  		return -ENOMEM;
>  
> -- 
> 2.41.0
> 
> 

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

* Re: [PATCH] net: stmmac: tegra: Properly allocate clock bulk data
  2023-07-26 16:32 [PATCH] net: stmmac: tegra: Properly allocate clock bulk data Thierry Reding
  2023-07-27 11:49 ` Simon Horman
@ 2023-07-29 16:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-07-29 16:10 UTC (permalink / raw)
  To: Thierry Reding
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, davem, edumazet, kuba,
	pabeni, jonathanh, netdev, linux-tegra

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Wed, 26 Jul 2023 18:32:00 +0200 you wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> The clock data is an array of struct clk_bulk_data, so make sure to
> allocate enough memory.
> 
> Fixes: d8ca113724e7 ("net: stmmac: tegra: Add MGBE support")
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> 
> [...]

Here is the summary with links:
  - net: stmmac: tegra: Properly allocate clock bulk data
    https://git.kernel.org/netdev/net/c/a0b1b2055be3

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-07-29 16:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-26 16:32 [PATCH] net: stmmac: tegra: Properly allocate clock bulk data Thierry Reding
2023-07-27 11:49 ` Simon Horman
2023-07-29 16:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).