From owner-svn-src-stable@freebsd.org  Mon Dec 19 09:32:31 2016
Return-Path: <owner-svn-src-stable@freebsd.org>
Delivered-To: svn-src-stable@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0EC9BC86475;
 Mon, 19 Dec 2016 09:32:31 +0000 (UTC)
 (envelope-from hselasky@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id D9EB4F03;
 Mon, 19 Dec 2016 09:32:30 +0000 (UTC)
 (envelope-from hselasky@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBJ9WUj0082276;
 Mon, 19 Dec 2016 09:32:30 GMT (envelope-from hselasky@FreeBSD.org)
Received: (from hselasky@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBJ9WTWp082274;
 Mon, 19 Dec 2016 09:32:29 GMT (envelope-from hselasky@FreeBSD.org)
Message-Id: <201612190932.uBJ9WTWp082274@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: hselasky set sender to
 hselasky@FreeBSD.org using -f
From: Hans Petter Selasky <hselasky@FreeBSD.org>
Date: Mon, 19 Dec 2016 09:32:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject: svn commit: r310243 - stable/11/sys/dev/mlx5/mlx5_en
X-SVN-Group: stable-11
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-stable@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: SVN commit messages for all the -stable branches of the src tree
 <svn-src-stable.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-stable>, 
 <mailto:svn-src-stable-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable/>
List-Post: <mailto:svn-src-stable@freebsd.org>
List-Help: <mailto:svn-src-stable-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-stable>,
 <mailto:svn-src-stable-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 19 Dec 2016 09:32:31 -0000

Author: hselasky
Date: Mon Dec 19 09:32:29 2016
New Revision: 310243
URL: https://svnweb.freebsd.org/changeset/base/310243

Log:
  MFC r309406:
  Remove useless NULL checks.
  
  NULL is not returned when allocating memory passing the M_WAITOK flag.
  
  Submitted by:		trasz @
  Differential Revision:  https://reviews.freebsd.org/D5772
  Sponsored by:           Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c	Mon Dec 19 09:28:12 2016	(r310242)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c	Mon Dec 19 09:32:29 2016	(r310243)
@@ -854,8 +854,6 @@ mlx5e_create_main_flow_table(struct mlx5
 	u8 *dmac;
 
 	g = malloc(9 * sizeof(*g), M_MLX5EN, M_WAITOK | M_ZERO);
-	if (g == NULL)
-		return (-ENOMEM);
 
 	g[0].log_sz = 2;
 	g[0].match_criteria_enable = MLX5_MATCH_OUTER_HEADERS;
@@ -939,8 +937,6 @@ mlx5e_create_vlan_flow_table(struct mlx5
 	struct mlx5_flow_table_group *g;
 
 	g = malloc(2 * sizeof(*g), M_MLX5EN, M_WAITOK | M_ZERO);
-	if (g == NULL)
-		return (-ENOMEM);
 
 	g[0].log_sz = 12;
 	g[0].match_criteria_enable = MLX5_MATCH_OUTER_HEADERS;

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Mon Dec 19 09:28:12 2016	(r310242)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Mon Dec 19 09:32:29 2016	(r310243)
@@ -656,10 +656,6 @@ mlx5e_create_rq(struct mlx5e_channel *c,
 		goto err_rq_wq_destroy;
 
 	rq->mbuf = malloc(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO);
-	if (rq->mbuf == NULL) {
-		err = -ENOMEM;
-		goto err_lro_init;
-	}
 	for (i = 0; i != wq_sz; i++) {
 		struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(&rq->wq, i);
 		uint32_t byte_count = rq->wqe_sz - MLX5E_NET_IP_ALIGN;
@@ -686,7 +682,6 @@ mlx5e_create_rq(struct mlx5e_channel *c,
 
 err_rq_mbuf_free:
 	free(rq->mbuf, M_MLX5EN);
-err_lro_init:
 	tcp_lro_free(&rq->lro);
 err_rq_wq_destroy:
 	mlx5_wq_destroy(&rq->wq_ctrl);
@@ -897,8 +892,6 @@ mlx5e_alloc_sq_db(struct mlx5e_sq *sq)
 	int x;
 
 	sq->mbuf = malloc(wq_sz * sizeof(sq->mbuf[0]), M_MLX5EN, M_WAITOK | M_ZERO);
-	if (sq->mbuf == NULL)
-		return (-ENOMEM);
 
 	/* Create DMA descriptor MAPs */
 	for (x = 0; x != wq_sz; x++) {
@@ -1486,9 +1479,6 @@ mlx5e_open_channel(struct mlx5e_priv *pr
 	int err;
 
 	c = malloc(sizeof(*c), M_MLX5EN, M_WAITOK | M_ZERO);
-	if (c == NULL)
-		return (-ENOMEM);
-
 	c->priv = priv;
 	c->ix = ix;
 	c->cpu = 0;
@@ -1699,8 +1689,6 @@ mlx5e_open_channels(struct mlx5e_priv *p
 
 	priv->channel = malloc(priv->params.num_channels *
 	    sizeof(struct mlx5e_channel *), M_MLX5EN, M_WAITOK | M_ZERO);
-	if (priv->channel == NULL)
-		return (-ENOMEM);
 
 	mlx5e_build_channel_param(priv, &cparam);
 	for (i = 0; i < priv->params.num_channels; i++) {
@@ -2879,10 +2867,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *m
 		return (NULL);
 	}
 	priv = malloc(sizeof(*priv), M_MLX5EN, M_WAITOK | M_ZERO);
-	if (priv == NULL) {
-		mlx5_core_err(mdev, "malloc() failed\n");
-		return (NULL);
-	}
 	mlx5e_priv_mtx_init(priv);
 
 	ifp = priv->ifp = if_alloc(IFT_ETHER);