Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760549AbbBIKVf (ORCPT ); Mon, 9 Feb 2015 05:21:35 -0500 Received: from mout.web.de ([212.227.17.11]:54670 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760404AbbBIKVd (ORCPT ); Mon, 9 Feb 2015 05:21:33 -0500 Message-ID: <54D88A26.2060307@users.sourceforge.net> Date: Mon, 09 Feb 2015 11:21:26 +0100 From: SF Markus Elfring User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: David Miller CC: Eli Cohen , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Julia Lawall Subject: [PATCH v2] net: Mellanox: Delete unnecessary checks before the function call "vunmap" References: <5317A59D.4@users.sourceforge.net> <54D22B29.3020200@users.sourceforge.net> <20150205.003404.261962007607296519.davem@davemloft.net> In-Reply-To: <20150205.003404.261962007607296519.davem@davemloft.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:YnkczSFqiqW8DBKuaIwpZeUqeSutq+j9eGH6GaNRYJfM94uBuRA 5uQ+fe9UDXi2HnylS57/JwOplUw9MInF5qfY91C/yS9dqi9Y5bmBAN0nxO2LP6M8QbBe/Mp wmHIXGjj0piLqn8mC3U+L7Mp1UBEbsTwmGq4K48GFiDQu3/+AVCqgK+WJw8NwxE7pTP1Ke2 kH3PY8B0eC1AFHm3NczoA== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1885 Lines: 49 From: Markus Elfring Date: Mon, 9 Feb 2015 11:10:41 +0100 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 Acked-by: Eli Cohen --- drivers/net/ethernet/mellanox/mlx4/alloc.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/alloc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/alloc.c b/drivers/net/ethernet/mellanox/mlx4/alloc.c index a716c26..0c51c69 100644 --- a/drivers/net/ethernet/mellanox/mlx4/alloc.c +++ b/drivers/net/ethernet/mellanox/mlx4/alloc.c @@ -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) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c index 56779c1..201ca6d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c @@ -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++) -- 2.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/