mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-25 10:19:47 +00:00
mlx4_en: Added missing iounmap upon releasing a device
Fixed a memory leak caused by missing iounmap when device is being released. Signed-off-by: Alexander Guller <alexg@mellanox.co.il> Signed-off-by: Sharon Cohen <sharonc@mellanox.co.il> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6b4d8d9fd1
commit
7398af403f
1 changed files with 5 additions and 1 deletions
|
@ -176,6 +176,7 @@ static void mlx4_en_remove(struct mlx4_dev *dev, void *endev_ptr)
|
||||||
flush_workqueue(mdev->workqueue);
|
flush_workqueue(mdev->workqueue);
|
||||||
destroy_workqueue(mdev->workqueue);
|
destroy_workqueue(mdev->workqueue);
|
||||||
mlx4_mr_free(dev, &mdev->mr);
|
mlx4_mr_free(dev, &mdev->mr);
|
||||||
|
iounmap(mdev->uar_map);
|
||||||
mlx4_uar_free(dev, &mdev->priv_uar);
|
mlx4_uar_free(dev, &mdev->priv_uar);
|
||||||
mlx4_pd_free(dev, mdev->priv_pdn);
|
mlx4_pd_free(dev, mdev->priv_pdn);
|
||||||
kfree(mdev);
|
kfree(mdev);
|
||||||
|
@ -223,7 +224,7 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
|
||||||
MLX4_PERM_LOCAL_WRITE | MLX4_PERM_LOCAL_READ,
|
MLX4_PERM_LOCAL_WRITE | MLX4_PERM_LOCAL_READ,
|
||||||
0, 0, &mdev->mr)) {
|
0, 0, &mdev->mr)) {
|
||||||
mlx4_err(mdev, "Failed allocating memory region\n");
|
mlx4_err(mdev, "Failed allocating memory region\n");
|
||||||
goto err_uar;
|
goto err_map;
|
||||||
}
|
}
|
||||||
if (mlx4_mr_enable(mdev->dev, &mdev->mr)) {
|
if (mlx4_mr_enable(mdev->dev, &mdev->mr)) {
|
||||||
mlx4_err(mdev, "Failed enabling memory region\n");
|
mlx4_err(mdev, "Failed enabling memory region\n");
|
||||||
|
@ -282,6 +283,9 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
|
||||||
|
|
||||||
err_mr:
|
err_mr:
|
||||||
mlx4_mr_free(dev, &mdev->mr);
|
mlx4_mr_free(dev, &mdev->mr);
|
||||||
|
err_map:
|
||||||
|
if (!mdev->uar_map)
|
||||||
|
iounmap(mdev->uar_map);
|
||||||
err_uar:
|
err_uar:
|
||||||
mlx4_uar_free(dev, &mdev->priv_uar);
|
mlx4_uar_free(dev, &mdev->priv_uar);
|
||||||
err_pd:
|
err_pd:
|
||||||
|
|
Loading…
Reference in a new issue