diff mbox series

net: dwc_eth_qos: fix double resource leak in eqos_remove()

Message ID 20220511141250.2051522-1-rasmus.villemoes@prevas.dk
State Accepted
Commit 4a7c9dbf9a42330970a9742c1d476f2a9075f3f9
Delegated to: Tom Rini
Headers show
Series net: dwc_eth_qos: fix double resource leak in eqos_remove() | expand

Commit Message

Rasmus Villemoes May 11, 2022, 2:12 p.m. UTC
Not only does eqos_remove() fail to free the buffers that have been
allocated by eqos_probe_resources_core(), it repeats those allocations
and thus drops twice as much memory on the floor.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---
 drivers/net/dwc_eth_qos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ramon Fried May 16, 2022, 12:26 a.m. UTC | #1
On Wed, May 11, 2022 at 5:13 PM Rasmus Villemoes
<rasmus.villemoes@prevas.dk> wrote:
>
> Not only does eqos_remove() fail to free the buffers that have been
> allocated by eqos_probe_resources_core(), it repeats those allocations
> and thus drops twice as much memory on the floor.
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> ---
>  drivers/net/dwc_eth_qos.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c
> index 9d255cf95f..82ee2d9706 100644
> --- a/drivers/net/dwc_eth_qos.c
> +++ b/drivers/net/dwc_eth_qos.c
> @@ -1884,7 +1884,7 @@ static int eqos_remove(struct udevice *dev)
>         eqos->config->ops->eqos_stop_clks(dev);
>         eqos->config->ops->eqos_remove_resources(dev);
>
> -       eqos_probe_resources_core(dev);
> +       eqos_remove_resources_core(dev);
>
>         debug("%s: OK\n", __func__);
>         return 0;
> --
> 2.31.1
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Rasmus Villemoes Aug. 4, 2022, 12:48 p.m. UTC | #2
On 16/05/2022 02.26, Ramon Fried wrote:
> On Wed, May 11, 2022 at 5:13 PM Rasmus Villemoes
> <rasmus.villemoes@prevas.dk> wrote:
>>
>> Not only does eqos_remove() fail to free the buffers that have been
>> allocated by eqos_probe_resources_core(), it repeats those allocations
>> and thus drops twice as much memory on the floor.
>>
> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>

ping on this as well.
Tom Rini Aug. 8, 2022, 7:07 p.m. UTC | #3
On Wed, May 11, 2022 at 04:12:50PM +0200, Rasmus Villemoes wrote:

> Not only does eqos_remove() fail to free the buffers that have been
> allocated by eqos_probe_resources_core(), it repeats those allocations
> and thus drops twice as much memory on the floor.
> 
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c
index 9d255cf95f..82ee2d9706 100644
--- a/drivers/net/dwc_eth_qos.c
+++ b/drivers/net/dwc_eth_qos.c
@@ -1884,7 +1884,7 @@  static int eqos_remove(struct udevice *dev)
 	eqos->config->ops->eqos_stop_clks(dev);
 	eqos->config->ops->eqos_remove_resources(dev);
 
-	eqos_probe_resources_core(dev);
+	eqos_remove_resources_core(dev);
 
 	debug("%s: OK\n", __func__);
 	return 0;