net: Mellanox: Delete unnecessary checks before the function call "vunmap"
authorMarkus Elfring <elfring@users.sourceforge.net>
Mon, 9 Feb 2015 10:10:41 +0000 (11:10 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 9 Feb 2015 22:10:05 +0000 (14:10 -0800)
The vunmap() function performs also input parameter validation.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/alloc.c
drivers/net/ethernet/mellanox/mlx5/core/alloc.c

index a716c26e0d99cce1d62a6a1e6472bc43bcc6c2ee..0c51c69f802faf63a849300508ad4e809eeb7e3a 100644 (file)
@@ -662,7 +662,7 @@ void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf)
                                  buf->direct.buf,
                                  buf->direct.map);
        else {
-               if (BITS_PER_LONG == 64 && buf->direct.buf)
+               if (BITS_PER_LONG == 64)
                        vunmap(buf->direct.buf);
 
                for (i = 0; i < buf->nbufs; ++i)
index 56779c1c78113c72312beff9b4d655a8f281cf9c..201ca6d76ce563862b6f2d620b68c69e3e58002a 100644 (file)
@@ -121,7 +121,7 @@ void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf)
                dma_free_coherent(&dev->pdev->dev, buf->size, buf->direct.buf,
                                  buf->direct.map);
        else {
-               if (BITS_PER_LONG == 64 && buf->direct.buf)
+               if (BITS_PER_LONG == 64)
                        vunmap(buf->direct.buf);
 
                for (i = 0; i < buf->nbufs; i++)