Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1619098 > unrolled thread

[PATCH 0/9] InfiniBand-ULP: Fine-tuning for several function implementations

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-04-07 23:00 +0200
Last post2017-04-09 14:30 +0200
Articles 16 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/9] InfiniBand-ULP: Fine-tuning for several function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-07 23:00 +0200
    [PATCH 9/9] IB/isert: Improve size determinations in three functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-07 23:10 +0200
      Re: [PATCH 9/9] IB/isert: Improve size determinations in three  functions Sagi Grimberg <sagi@grimberg.me> - 2017-04-09 11:10 +0200
    [PATCH 8/9] IB/isert: Use kcalloc() in isert_alloc_rx_descriptors() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-07 23:10 +0200
      Re: [PATCH 8/9] IB/isert: Use kcalloc() in  isert_alloc_rx_descriptors() Sagi Grimberg <sagi@grimberg.me> - 2017-04-09 11:10 +0200
    [PATCH 6/9] IB/iser: Use kmalloc_array() in  iser_alloc_rx_descriptors() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-07 23:10 +0200
      Re: [PATCH 6/9] IB/iser: Use kmalloc_array() in  iser_alloc_rx_descriptors() Sagi Grimberg <sagi@grimberg.me> - 2017-04-09 11:10 +0200
    [PATCH 4/9] IB/IPoIB: Delete unwanted spaces behind usages of the  sizeof operator SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-07 23:10 +0200
      Re: [PATCH 4/9] IB/IPoIB: Delete unwanted spaces behind usages of the  sizeof operator Sagi Grimberg <sagi@grimberg.me> - 2017-04-09 14:30 +0200
    [PATCH 7/9] IB/iser: Add spaces for better code readability SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-07 23:10 +0200
      Re: [PATCH 7/9] IB/iser: Add spaces for better code readability Sagi Grimberg <sagi@grimberg.me> - 2017-04-09 11:10 +0200
    [PATCH 2/9] IB/IPoIB: Delete an error message for a failed memory  allocation SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-07 23:10 +0200
      Re: [PATCH 2/9] IB/IPoIB: Delete an error message for a failed memory  allocation Sagi Grimberg <sagi@grimberg.me> - 2017-04-09 14:30 +0200
    [PATCH 5/9] IB/IPoIB: Combine substrings for three messages SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-07 23:10 +0200
    [PATCH 3/9] IB/IPoIB: Enclose six expressions for the sizeof operator  by parentheses SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-07 23:10 +0200
      Re: [PATCH 3/9] IB/IPoIB: Enclose six expressions for the sizeof  operator by parentheses Sagi Grimberg <sagi@grimberg.me> - 2017-04-09 14:30 +0200

#1619098 — [PATCH 0/9] InfiniBand-ULP: Fine-tuning for several function implementations

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-07 23:00 +0200
Subject[PATCH 0/9] InfiniBand-ULP: Fine-tuning for several function implementations
Message-ID<ttJ97-4g5-3@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 7 Apr 2017 22:34:32 +0200

Some update suggestions were taken into account
from static source code analysis.

Markus Elfring (9):
  IPoIB: Use kcalloc() in two functions
  IPoIB: Delete an error message for a failed memory allocation
  IPoIB: Enclose six expressions for the sizeof operator by parentheses
  IPoIB: Delete unwanted spaces behind usages of the sizeof operator
  IPoIB: Combine substrings for three messages
  iser: Use kmalloc_array() in iser_alloc_rx_descriptors()
  iser: Add spaces for better code readability
  isert: Use kcalloc() in isert_alloc_rx_descriptors()
  isert: Improve size determinations in three functions

 drivers/infiniband/ulp/ipoib/ipoib_main.c    | 49 ++++++++++++++--------------
 drivers/infiniband/ulp/iser/iser_initiator.c | 11 ++++---
 drivers/infiniband/ulp/isert/ib_isert.c      | 11 ++++---
 3 files changed, 36 insertions(+), 35 deletions(-)

-- 
2.12.2

[toc] | [next] | [standalone]


#1619101 — [PATCH 9/9] IB/isert: Improve size determinations in three functions

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-07 23:10 +0200
Subject[PATCH 9/9] IB/isert: Improve size determinations in three functions
Message-ID<ttJiN-4zq-1@gated-at.bofh.it>
In reply to#1619098
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 7 Apr 2017 22:20:39 +0200

Replace the specification of three data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determinations a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/infiniband/ulp/isert/ib_isert.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index c56af6183082..5dafda92a642 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -368,7 +368,7 @@ isert_device_get(struct rdma_cm_id *cma_id)
 		}
 	}
 
-	device = kzalloc(sizeof(struct isert_device), GFP_KERNEL);
+	device = kzalloc(sizeof(*device), GFP_KERNEL);
 	if (!device) {
 		mutex_unlock(&device_list_mutex);
 		return ERR_PTR(-ENOMEM);
@@ -516,7 +516,7 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
 	isert_dbg("cma_id: %p, portal: %p\n",
 		 cma_id, cma_id->context);
 
-	isert_conn = kzalloc(sizeof(struct isert_conn), GFP_KERNEL);
+	isert_conn = kzalloc(sizeof(*isert_conn), GFP_KERNEL);
 	if (!isert_conn)
 		return -ENOMEM;
 
@@ -2306,7 +2306,7 @@ isert_setup_np(struct iscsi_np *np,
 	struct rdma_cm_id *isert_lid;
 	int ret;
 
-	isert_np = kzalloc(sizeof(struct isert_np), GFP_KERNEL);
+	isert_np = kzalloc(sizeof(*isert_np), GFP_KERNEL);
 	if (!isert_np)
 		return -ENOMEM;
 
-- 
2.12.2

[toc] | [prev] | [next] | [standalone]


#1619460 — Re: [PATCH 9/9] IB/isert: Improve size determinations in three functions

FromSagi Grimberg <sagi@grimberg.me>
Date2017-04-09 11:10 +0200
SubjectRe: [PATCH 9/9] IB/isert: Improve size determinations in three functions
Message-ID<tuh17-PZ-17@gated-at.bofh.it>
In reply to#1619101
Acked-by: Sagi Grimberg <sagi@grimberg.me>

[toc] | [prev] | [next] | [standalone]


#1619102 — [PATCH 8/9] IB/isert: Use kcalloc() in isert_alloc_rx_descriptors()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-07 23:10 +0200
Subject[PATCH 8/9] IB/isert: Use kcalloc() in isert_alloc_rx_descriptors()
Message-ID<ttJiN-4zq-3@gated-at.bofh.it>
In reply to#1619098
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 7 Apr 2017 22:00:43 +0200

* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus use the corresponding function "kcalloc".

* Replace the specification of a data structure by a pointer dereference
  to make the corresponding size determination a bit safer according to
  the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/infiniband/ulp/isert/ib_isert.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 91cbe86b25c8..c56af6183082 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -181,8 +181,9 @@ isert_alloc_rx_descriptors(struct isert_conn *isert_conn)
 	u64 dma_addr;
 	int i, j;
 
-	isert_conn->rx_descs = kzalloc(ISERT_QP_MAX_RECV_DTOS *
-				sizeof(struct iser_rx_desc), GFP_KERNEL);
+	isert_conn->rx_descs = kcalloc(ISERT_QP_MAX_RECV_DTOS,
+				       sizeof(*isert_conn->rx_descs),
+				       GFP_KERNEL);
 	if (!isert_conn->rx_descs)
 		return -ENOMEM;
 
-- 
2.12.2

[toc] | [prev] | [next] | [standalone]


#1619463 — Re: [PATCH 8/9] IB/isert: Use kcalloc() in isert_alloc_rx_descriptors()

FromSagi Grimberg <sagi@grimberg.me>
Date2017-04-09 11:10 +0200
SubjectRe: [PATCH 8/9] IB/isert: Use kcalloc() in isert_alloc_rx_descriptors()
Message-ID<tuh18-PZ-33@gated-at.bofh.it>
In reply to#1619102
Acked-by: Sagi Grimberg <sagi@grimberg.me>

[toc] | [prev] | [next] | [standalone]


#1619103 — [PATCH 6/9] IB/iser: Use kmalloc_array() in iser_alloc_rx_descriptors()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-07 23:10 +0200
Subject[PATCH 6/9] IB/iser: Use kmalloc_array() in iser_alloc_rx_descriptors()
Message-ID<ttJiN-4zq-5@gated-at.bofh.it>
In reply to#1619098
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 7 Apr 2017 21:23:29 +0200

* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus use the corresponding function "kmalloc_array".

* Replace the specification of a data structure by a pointer dereference
  to make the corresponding size determination a bit safer according to
  the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/infiniband/ulp/iser/iser_initiator.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index 81ae2e30dd12..6c48bdc8a64d 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -257,8 +257,9 @@ int iser_alloc_rx_descriptors(struct iser_conn *iser_conn,
 		goto alloc_login_buf_fail;
 
 	iser_conn->num_rx_descs = session->cmds_max;
-	iser_conn->rx_descs = kmalloc(iser_conn->num_rx_descs *
-				sizeof(struct iser_rx_desc), GFP_KERNEL);
+	iser_conn->rx_descs = kmalloc_array(iser_conn->num_rx_descs,
+					    sizeof(*iser_conn->rx_descs),
+					    GFP_KERNEL);
 	if (!iser_conn->rx_descs)
 		goto rx_desc_alloc_fail;
 
-- 
2.12.2

[toc] | [prev] | [next] | [standalone]


#1619461 — Re: [PATCH 6/9] IB/iser: Use kmalloc_array() in iser_alloc_rx_descriptors()

FromSagi Grimberg <sagi@grimberg.me>
Date2017-04-09 11:10 +0200
SubjectRe: [PATCH 6/9] IB/iser: Use kmalloc_array() in iser_alloc_rx_descriptors()
Message-ID<tuh18-PZ-27@gated-at.bofh.it>
In reply to#1619103
Acked-by: Sagi Grimberg <sagi@grimberg.me>

[toc] | [prev] | [next] | [standalone]


#1619105 — [PATCH 4/9] IB/IPoIB: Delete unwanted spaces behind usages of the sizeof operator

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-07 23:10 +0200
Subject[PATCH 4/9] IB/IPoIB: Delete unwanted spaces behind usages of the sizeof operator
Message-ID<ttJiO-4zq-19@gated-at.bofh.it>
In reply to#1619098
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 7 Apr 2017 20:10:45 +0200

* Replace the source code "sizeof (" by "sizeof("
  according to the Linux coding style convention.

* Adjust indentation at a few places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 446af4ec3d86..55581417eb43 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -514,8 +514,7 @@ struct ipoib_path *__path_find(struct net_device *dev, void *gid)
 		path = rb_entry(n, struct ipoib_path, rb_node);
 
 		ret = memcmp(gid, path->pathrec.dgid.raw,
-			     sizeof (union ib_gid));
-
+			     sizeof(union ib_gid));
 		if (ret < 0)
 			n = n->rb_left;
 		else if (ret > 0)
@@ -540,7 +539,7 @@ static int __path_add(struct net_device *dev, struct ipoib_path *path)
 		tpath = rb_entry(pn, struct ipoib_path, rb_node);
 
 		ret = memcmp(path->pathrec.dgid.raw, tpath->pathrec.dgid.raw,
-			     sizeof (union ib_gid));
+			     sizeof(union ib_gid));
 		if (ret < 0)
 			n = &pn->rb_left;
 		else if (ret > 0)
@@ -611,7 +610,7 @@ int ipoib_path_iter_next(struct ipoib_path_iter *iter)
 		path = rb_entry(n, struct ipoib_path, rb_node);
 
 		if (memcmp(iter->path.pathrec.dgid.raw, path->pathrec.dgid.raw,
-			   sizeof (union ib_gid)) < 0) {
+			   sizeof(union ib_gid)) < 0) {
 			iter->path = *path;
 			ret = 0;
 			break;
@@ -874,7 +873,7 @@ static struct ipoib_path *path_rec_create(struct net_device *dev, void *gid)
 
 	INIT_LIST_HEAD(&path->neigh_list);
 
-	memcpy(path->pathrec.dgid.raw, gid, sizeof (union ib_gid));
+	memcpy(path->pathrec.dgid.raw, gid, sizeof(union ib_gid));
 	path->pathrec.sgid	    = priv->local_gid;
 	path->pathrec.pkey	    = cpu_to_be16(priv->pkey);
 	path->pathrec.numb_path     = 1;
@@ -1541,7 +1540,8 @@ void ipoib_del_neighs_by_gid(struct net_device *dev, u8 *gid)
 		while ((neigh = rcu_dereference_protected(*np,
 							  lockdep_is_held(&priv->lock))) != NULL) {
 			/* delete neighs belong to this parent */
-			if (!memcmp(gid, neigh->daddr + 4, sizeof (union ib_gid))) {
+			if (!memcmp(gid, neigh->daddr + 4,
+				    sizeof(union ib_gid))) {
 				rcu_assign_pointer(*np,
 						   rcu_dereference_protected(neigh->hnext,
 									     lockdep_is_held(&priv->lock)));
@@ -2060,7 +2060,8 @@ static struct net_device *ipoib_add_port(const char *format,
 		       hca->name, port, result);
 		goto device_init_failed;
 	} else
-		memcpy(priv->dev->dev_addr + 4, priv->local_gid.raw, sizeof (union ib_gid));
+		memcpy(priv->dev->dev_addr + 4, priv->local_gid.raw,
+		       sizeof(union ib_gid));
 	set_bit(IPOIB_FLAG_DEV_ADDR_SET, &priv->flags);
 
 	result = ipoib_dev_init(priv->dev, hca, port);
-- 
2.12.2

[toc] | [prev] | [next] | [standalone]


#1619484 — Re: [PATCH 4/9] IB/IPoIB: Delete unwanted spaces behind usages of the sizeof operator

FromSagi Grimberg <sagi@grimberg.me>
Date2017-04-09 14:30 +0200
SubjectRe: [PATCH 4/9] IB/IPoIB: Delete unwanted spaces behind usages of the sizeof operator
Message-ID<tuk8F-2Iy-1@gated-at.bofh.it>
In reply to#1619105
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

[toc] | [prev] | [next] | [standalone]


#1619106 — [PATCH 7/9] IB/iser: Add spaces for better code readability

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-07 23:10 +0200
Subject[PATCH 7/9] IB/iser: Add spaces for better code readability
Message-ID<ttJiN-4zq-9@gated-at.bofh.it>
In reply to#1619098
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 7 Apr 2017 21:37:48 +0200

The script "checkpatch.pl" pointed information out like the following.

ERROR: space required after that ',' (ctx:VxV)

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/infiniband/ulp/iser/iser_initiator.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index 6c48bdc8a64d..fbab1303a740 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -422,7 +422,7 @@ int iser_send_command(struct iscsi_conn *conn,
 		return 0;
 
 send_command_error:
-	iser_err("conn %p failed task->itt %d err %d\n",conn, task->itt, err);
+	iser_err("conn %p failed task->itt %d err %d\n", conn, task->itt, err);
 	return err;
 }
 
@@ -448,7 +448,7 @@ int iser_send_data_out(struct iscsi_conn *conn,
 	buf_offset   = ntohl(hdr->offset);
 
 	iser_dbg("%s itt %d dseg_len %d offset %d\n",
-		 __func__,(int)itt,(int)data_seg_len,(int)buf_offset);
+		 __func__, (int)itt, (int)data_seg_len, (int)buf_offset);
 
 	tx_desc = kmem_cache_zalloc(ig.desc_cache, GFP_ATOMIC);
 	if (tx_desc == NULL) {
@@ -553,7 +553,7 @@ int iser_send_control(struct iscsi_conn *conn,
 		return 0;
 
 send_control_error:
-	iser_err("conn %p failed err %d\n",conn, err);
+	iser_err("conn %p failed err %d\n", conn, err);
 	return err;
 }
 
-- 
2.12.2

[toc] | [prev] | [next] | [standalone]


#1619457 — Re: [PATCH 7/9] IB/iser: Add spaces for better code readability

FromSagi Grimberg <sagi@grimberg.me>
Date2017-04-09 11:10 +0200
SubjectRe: [PATCH 7/9] IB/iser: Add spaces for better code readability
Message-ID<tuh17-PZ-5@gated-at.bofh.it>
In reply to#1619106
Acked-by: Sagi Grimberg <sagi@grimberg.me>

[toc] | [prev] | [next] | [standalone]


#1619108 — [PATCH 2/9] IB/IPoIB: Delete an error message for a failed memory allocation

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-07 23:10 +0200
Subject[PATCH 2/9] IB/IPoIB: Delete an error message for a failed memory allocation
Message-ID<ttJiO-4zq-17@gated-at.bofh.it>
In reply to#1619098
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 7 Apr 2017 19:23:55 +0200

The script "checkpatch.pl" pointed information out like the following.

WARNING: Possible unnecessary 'out of memory' message

Thus remove such a statement here.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 3d3e49fb15b7..c5024c6d38e7 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1634,11 +1634,8 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port)
 		goto out;
 
 	priv->tx_ring = vzalloc(ipoib_sendq_size * sizeof *priv->tx_ring);
-	if (!priv->tx_ring) {
-		printk(KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n",
-		       ca->name, ipoib_sendq_size);
+	if (!priv->tx_ring)
 		goto out_rx_ring_cleanup;
-	}
 
 	/* priv->tx_head, tx_tail & tx_outstanding are already 0 */
 
-- 
2.12.2

[toc] | [prev] | [next] | [standalone]


#1619487 — Re: [PATCH 2/9] IB/IPoIB: Delete an error message for a failed memory allocation

FromSagi Grimberg <sagi@grimberg.me>
Date2017-04-09 14:30 +0200
SubjectRe: [PATCH 2/9] IB/IPoIB: Delete an error message for a failed memory allocation
Message-ID<tuk8G-2Iy-11@gated-at.bofh.it>
In reply to#1619108
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

[toc] | [prev] | [next] | [standalone]


#1619110 — [PATCH 5/9] IB/IPoIB: Combine substrings for three messages

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-07 23:10 +0200
Subject[PATCH 5/9] IB/IPoIB: Combine substrings for three messages
Message-ID<ttJiO-4zq-23@gated-at.bofh.it>
In reply to#1619098
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 7 Apr 2017 21:06:08 +0200

The script "checkpatch.pl" pointed information out like the following.

WARNING: quoted string split across lines

Thus fix affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 55581417eb43..43aef0ca53ad 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -226,8 +226,9 @@ static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
 	priv->admin_mtu = new_mtu;
 
 	if (priv->mcast_mtu < priv->admin_mtu)
-		ipoib_dbg(priv, "MTU must be smaller than the underlying "
-				"link layer MTU - 4 (%u)\n", priv->mcast_mtu);
+		ipoib_dbg(priv,
+			  "MTU must be smaller than the underlying link layer MTU - 4 (%u)\n",
+			  priv->mcast_mtu);
 
 	dev->mtu = min(priv->mcast_mtu, priv->admin_mtu);
 
@@ -480,8 +481,8 @@ int ipoib_set_mode(struct net_device *dev, const char *buf)
 	/* flush paths if we switch modes so that connections are restarted */
 	if (IPOIB_CM_SUPPORTED(dev->dev_addr) && !strcmp(buf, "connected\n")) {
 		set_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags);
-		ipoib_warn(priv, "enabling connected mode "
-			   "will cause multicast packet drops\n");
+		ipoib_warn(priv,
+			   "enabling connected mode will cause multicast packet drops\n");
 		netdev_update_features(dev);
 		dev_set_mtu(dev, ipoib_cm_max_mtu(dev));
 		rtnl_unlock();
@@ -1855,8 +1856,8 @@ void ipoib_set_umcast(struct net_device *ndev, int umcast_val)
 
 	if (umcast_val > 0) {
 		set_bit(IPOIB_FLAG_UMCAST, &priv->flags);
-		ipoib_warn(priv, "ignoring multicast groups joined directly "
-				"by userspace\n");
+		ipoib_warn(priv,
+			   "ignoring multicast groups joined directly by userspace\n");
 	} else
 		clear_bit(IPOIB_FLAG_UMCAST, &priv->flags);
 }
-- 
2.12.2

[toc] | [prev] | [next] | [standalone]


#1619111 — [PATCH 3/9] IB/IPoIB: Enclose six expressions for the sizeof operator by parentheses

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-04-07 23:10 +0200
Subject[PATCH 3/9] IB/IPoIB: Enclose six expressions for the sizeof operator by parentheses
Message-ID<ttJiO-4zq-25@gated-at.bofh.it>
In reply to#1619098
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 7 Apr 2017 19:54:15 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script "checkpatch.pl" pointed information out like the following.

WARNING: sizeof *… should be sizeof(*…)

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index c5024c6d38e7..446af4ec3d86 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -581,7 +581,7 @@ struct ipoib_path_iter *ipoib_path_iter_init(struct net_device *dev)
 {
 	struct ipoib_path_iter *iter;
 
-	iter = kmalloc(sizeof *iter, GFP_KERNEL);
+	iter = kmalloc(sizeof(*iter), GFP_KERNEL);
 	if (!iter)
 		return NULL;
 
@@ -864,7 +864,7 @@ static struct ipoib_path *path_rec_create(struct net_device *dev, void *gid)
 	if (!priv->broadcast)
 		return NULL;
 
-	path = kzalloc(sizeof *path, GFP_ATOMIC);
+	path = kzalloc(sizeof(*path), GFP_ATOMIC);
 	if (!path)
 		return NULL;
 
@@ -1161,7 +1161,7 @@ static int ipoib_hard_header(struct sk_buff *skb,
 {
 	struct ipoib_header *header;
 
-	header = (struct ipoib_header *) skb_push(skb, sizeof *header);
+	header = (struct ipoib_header *)skb_push(skb, sizeof(*header));
 
 	header->proto = htons(type);
 	header->reserved = 0;
@@ -1329,7 +1329,7 @@ static struct ipoib_neigh *ipoib_neigh_ctor(u8 *daddr,
 {
 	struct ipoib_neigh *neigh;
 
-	neigh = kzalloc(sizeof *neigh, GFP_ATOMIC);
+	neigh = kzalloc(sizeof(*neigh), GFP_ATOMIC);
 	if (!neigh)
 		return NULL;
 
@@ -1633,7 +1633,7 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port)
 	if (!priv->rx_ring)
 		goto out;
 
-	priv->tx_ring = vzalloc(ipoib_sendq_size * sizeof *priv->tx_ring);
+	priv->tx_ring = vzalloc(ipoib_sendq_size * sizeof(*priv->tx_ring));
 	if (!priv->tx_ring)
 		goto out_rx_ring_cleanup;
 
@@ -2132,7 +2132,7 @@ static void ipoib_add_one(struct ib_device *device)
 	int p;
 	int count = 0;
 
-	dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL);
+	dev_list = kmalloc(sizeof(*dev_list), GFP_KERNEL);
 	if (!dev_list)
 		return;
 
-- 
2.12.2

[toc] | [prev] | [next] | [standalone]


#1619486 — Re: [PATCH 3/9] IB/IPoIB: Enclose six expressions for the sizeof operator by parentheses

FromSagi Grimberg <sagi@grimberg.me>
Date2017-04-09 14:30 +0200
SubjectRe: [PATCH 3/9] IB/IPoIB: Enclose six expressions for the sizeof operator by parentheses
Message-ID<tuk8G-2Iy-7@gated-at.bofh.it>
In reply to#1619111
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web