Commit c2a3d4b4 authored by Jack Morgenstein's avatar Jack Morgenstein Committed by David S. Miller

net/mlx4_en: Cleanups suggested by clang static checker

clang flagged the following. All are actually cosmetic cleanups, not really bugs:

drivers/net/ethernet/mellanox/mlx4/en_main.c:233:3: warning: Value stored to 'err' is never read
                err = -ENOMEM;
                ^     ~~~~~~~
drivers/net/ethernet/mellanox/mlx4/en_main.c:293:3: warning: Value stored to 'err' is never read
                err = -ENOMEM;

drivers/net/ethernet/mellanox/mlx4/en_netdev.c:648:16: warning: Assigned value is garbage or undefined
        entry->reg_id = reg_id;
                      ^ ~~~~~~
drivers/net/ethernet/mellanox/mlx4/en_netdev.c:659:2: warning: Function call argument is an uninitialized value
        mlx4_en_uc_steer_release(priv, priv->dev->dev_addr, *qpn, reg_id);
(NOTE: reg_id is only used in the device-managed flow steering path, in which is it always initialized.
 This is not a bug. Cleanup here is therefore cosmetic only).

drivers/net/ethernet/mellanox/mlx4/en_rx.c:122:3: warning: Value stored to 'frag_info' is never read
                frag_info = &priv->frag_info[i];
                ^           ~~~~~~~~~~~~~~~~~~~
Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: default avatarAmir Vadai <amirv@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 537f6f95
...@@ -221,15 +221,12 @@ static void *mlx4_en_add(struct mlx4_dev *dev) ...@@ -221,15 +221,12 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
{ {
struct mlx4_en_dev *mdev; struct mlx4_en_dev *mdev;
int i; int i;
int err;
printk_once(KERN_INFO "%s", mlx4_en_version); printk_once(KERN_INFO "%s", mlx4_en_version);
mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
if (!mdev) { if (!mdev)
err = -ENOMEM;
goto err_free_res; goto err_free_res;
}
if (mlx4_pd_alloc(dev, &mdev->priv_pdn)) if (mlx4_pd_alloc(dev, &mdev->priv_pdn))
goto err_free_dev; goto err_free_dev;
...@@ -264,8 +261,7 @@ static void *mlx4_en_add(struct mlx4_dev *dev) ...@@ -264,8 +261,7 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
} }
/* Build device profile according to supplied module parameters */ /* Build device profile according to supplied module parameters */
err = mlx4_en_get_profile(mdev); if (mlx4_en_get_profile(mdev)) {
if (err) {
mlx4_err(mdev, "Bad module parameters, aborting\n"); mlx4_err(mdev, "Bad module parameters, aborting\n");
goto err_mr; goto err_mr;
} }
...@@ -286,10 +282,8 @@ static void *mlx4_en_add(struct mlx4_dev *dev) ...@@ -286,10 +282,8 @@ static void *mlx4_en_add(struct mlx4_dev *dev)
* Note: we cannot use the shared workqueue because of deadlocks caused * Note: we cannot use the shared workqueue because of deadlocks caused
* by the rtnl lock */ * by the rtnl lock */
mdev->workqueue = create_singlethread_workqueue("mlx4_en"); mdev->workqueue = create_singlethread_workqueue("mlx4_en");
if (!mdev->workqueue) { if (!mdev->workqueue)
err = -ENOMEM;
goto err_mr; goto err_mr;
}
/* At this stage all non-port specific tasks are complete: /* At this stage all non-port specific tasks are complete:
* mark the card state as up */ * mark the card state as up */
......
...@@ -575,7 +575,7 @@ static int mlx4_en_get_qp(struct mlx4_en_priv *priv) ...@@ -575,7 +575,7 @@ static int mlx4_en_get_qp(struct mlx4_en_priv *priv)
struct mlx4_mac_entry *entry; struct mlx4_mac_entry *entry;
int index = 0; int index = 0;
int err = 0; int err = 0;
u64 reg_id; u64 reg_id = 0;
int *qpn = &priv->base_qpn; int *qpn = &priv->base_qpn;
u64 mac = mlx4_mac_to_u64(priv->dev->dev_addr); u64 mac = mlx4_mac_to_u64(priv->dev->dev_addr);
......
...@@ -119,7 +119,6 @@ static int mlx4_en_alloc_frags(struct mlx4_en_priv *priv, ...@@ -119,7 +119,6 @@ static int mlx4_en_alloc_frags(struct mlx4_en_priv *priv,
out: out:
while (i--) { while (i--) {
frag_info = &priv->frag_info[i];
if (page_alloc[i].page != ring_alloc[i].page) { if (page_alloc[i].page != ring_alloc[i].page) {
dma_unmap_page(priv->ddev, page_alloc[i].dma, dma_unmap_page(priv->ddev, page_alloc[i].dma,
page_alloc[i].page_size, PCI_DMA_FROMDEVICE); page_alloc[i].page_size, PCI_DMA_FROMDEVICE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment