Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b6f8fb3d authored by Bhaumik Bhatt's avatar Bhaumik Bhatt
Browse files

bus: mhi_netdev: Free background memory pool during memory free



Fix freeing the background memory pool to avoid kmemleak as
part of freeing the memory pool.

Change-Id: I29c9d972295900bd0b97c8ab8ee73d668e05a59f
Signed-off-by: default avatarBhaumik Bhatt <bbhatt@codeaurora.org>
parent d63aafbd
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.*/
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.*/

#include <linux/module.h>
#include <linux/kernel.h>
@@ -411,6 +411,8 @@ static void mhi_netdev_free_pool(struct mhi_netdev *mhi_netdev)
		__free_pages(mhi_buf->page, mhi_netdev->order);
		mhi_netdev->bg_pool_size--;
	}

	kfree(mhi_netdev->bg_pool);
}

static int mhi_netdev_alloc_thread(void *data)
@@ -943,6 +945,7 @@ static void mhi_netdev_remove(struct mhi_device *mhi_dev)
	unregister_netdev(mhi_netdev->ndev);
	netif_napi_del(mhi_netdev->napi);
	free_netdev(mhi_netdev->ndev);
	mhi_netdev->ndev = NULL;

	if (!IS_ERR_OR_NULL(mhi_netdev->dentry))
		debugfs_remove_recursive(mhi_netdev->dentry);