Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1583970 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2017-02-18 21:50 +0100 |
| Last post | 2017-02-18 22:50 +0100 |
| Articles | 20 on this page of 49 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 00/29] IB/mlx: Fine-tuning for several function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 21:50 +0100
[PATCH 04/29] IB/mlx4: Improve another size determination in alloc_pv_object() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:00 +0100
Re: [PATCH 04/29] IB/mlx4: Improve another size determination in alloc_pv_object() Majd Dibbiny <majd@mellanox.com> - 2017-02-19 18:10 +0100
[PATCH 01/29] IB/mlx4: Use kcalloc() in mlx4_ib_alloc_pv_bufs() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:00 +0100
Re: [PATCH 01/29] IB/mlx4: Use kcalloc() in mlx4_ib_alloc_pv_bufs() Majd Dibbiny <majd@mellanox.com> - 2017-02-19 18:10 +0100
[PATCH 09/29] IB/mlx4: Move an assignment out of a check in forward_trap() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:00 +0100
Re: [PATCH 09/29] IB/mlx4: Move an assignment out of a check in forward_trap() Majd Dibbiny <majd@mellanox.com> - 2017-02-19 18:20 +0100
[PATCH 03/29] IB/mlx4: Improve another size determination in mlx4_ib_alloc_demux_ctx() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:00 +0100
Re: [PATCH 03/29] IB/mlx4: Improve another size determination in mlx4_ib_alloc_demux_ctx() Majd Dibbiny <majd@mellanox.com> - 2017-02-19 18:10 +0100
[PATCH 06/29] IB/mlx4: Delete three unnecessary return statements SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:00 +0100
Re: [PATCH 06/29] IB/mlx4: Delete three unnecessary return statements Majd Dibbiny <majd@mellanox.com> - 2017-02-19 18:10 +0100
[PATCH 05/29] IB/mlx4: Fix a typo in a comment line SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:00 +0100
Re: [PATCH 05/29] IB/mlx4: Fix a typo in a comment line Majd Dibbiny <majd@mellanox.com> - 2017-02-19 18:10 +0100
[PATCH 07/29] IB/mlx4: Split a condition check in handle_slaves_guid_change() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:00 +0100
Re: [PATCH 07/29] IB/mlx4: Split a condition check in handle_slaves_guid_change() Majd Dibbiny <majd@mellanox.com> - 2017-02-19 18:10 +0100
[PATCH 10/29] IB/mlx4: Enclose 15 expressions for the sizeof operator by parentheses SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:00 +0100
Re: [PATCH 10/29] IB/mlx4: Enclose 15 expressions for the sizeof operator by parentheses Majd Dibbiny <majd@mellanox.com> - 2017-02-19 18:30 +0100
[PATCH 15/29] IB/mlx4: Delete an unnecessary return statement in do_slave_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:10 +0100
Re: [PATCH 15/29] IB/mlx4: Delete an unnecessary return statement in do_slave_init() Majd Dibbiny <majd@mellanox.com> - 2017-02-19 23:40 +0100
[PATCH 11/29] IB/mlx4: Use kmalloc_array() in three functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:10 +0100
Re: [PATCH 11/29] IB/mlx4: Use kmalloc_array() in three functions Majd Dibbiny <majd@mellanox.com> - 2017-02-19 18:30 +0100
[PATCH 13/29] IB/mlx4: Split a condition check in five functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:10 +0100
Re: [PATCH 13/29] IB/mlx4: Split a condition check in five functions Majd Dibbiny <majd@mellanox.com> - 2017-02-19 18:30 +0100
[PATCH 12/29] IB/mlx4: Enclose 17 expressions for the sizeof operator by parentheses SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:10 +0100
Re: [PATCH 12/29] IB/mlx4: Enclose 17 expressions for the sizeof operator by parentheses Majd Dibbiny <majd@mellanox.com> - 2017-02-19 18:30 +0100
[PATCH 18/29] IB/mlx4: Delete an unnecessary variable initialisation in mlx4_ib_add() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:10 +0100
[PATCH 19/29] IB/mlx4: Delete an unnecessary variable assignment in mlx4_ib_add() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:10 +0100
Re: [PATCH 19/29] IB/mlx4: Delete an unnecessary variable assignment in mlx4_ib_add() Majd Dibbiny <majd@mellanox.com> - 2017-02-19 20:50 +0100
[PATCH 14/29] IB/mlx4: Delete an unnecessary variable in __mlx4_ib_query_gid() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:10 +0100
[PATCH 17/29] IB/mlx4: Improve another size determination in mlx4_ib_add() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:10 +0100
Re: [PATCH 17/29] IB/mlx4: Improve another size determination in mlx4_ib_add() Majd Dibbiny <majd@mellanox.com> - 2017-02-19 18:40 +0100
Re: [PATCH 17/29] IB/mlx4: Improve another size determination in mlx4_ib_add() Majd Dibbiny <majd@mellanox.com> - 2017-02-19 18:40 +0100
[PATCH 22/29] IB/mlx4: Use kmalloc_array() in alloc_proxy_bufs() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:20 +0100
Re: [PATCH 22/29] IB/mlx4: Use kmalloc_array() in alloc_proxy_bufs() Majd Dibbiny <majd@mellanox.com> - 2017-02-19 21:00 +0100
[PATCH 20/29] IB/mlx4: Delete an error message for a failed memory allocation in mlx4_ib_add() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:20 +0100
Re: [PATCH 20/29] IB/mlx4: Delete an error message for a failed memory allocation in mlx4_ib_add() Majd Dibbiny <majd@mellanox.com> - 2017-02-19 20:50 +0100
[PATCH 21/29] IB/mlx4: Delete unnecessary braces in mlx4_ib_add() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:20 +0100
Re: [PATCH 21/29] IB/mlx4: Delete unnecessary braces in mlx4_ib_add() Majd Dibbiny <majd@mellanox.com> - 2017-02-19 21:10 +0100
[PATCH 29/29] IB/mlx5: Use kmalloc_array() in create_srq_kernel() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:20 +0100
[PATCH 24/29] IB/mlx4: Delete unwanted spaces behind usages of the sizeof operator SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:20 +0100
[PATCH 28/29] IB/mlx5: Less function calls in create_kernel_qp() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:20 +0100
[PATCH 27/29] IB/mlx5: Use kmalloc_array() in create_kernel_qp() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:20 +0100
[PATCH 23/29] IB/mlx4: Improve size determinations in create_qp_common() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:20 +0100
Re: [PATCH 23/29] IB/mlx4: Improve size determinations in create_qp_common() Majd Dibbiny <majd@mellanox.com> - 2017-02-19 21:00 +0100
[PATCH 16/29] IB/mlx4: Improve another size determination in do_slave_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:20 +0100
[PATCH 08/29] IB/mlx4: Delete an unnecessary check before the function call "kfree" in free_pv_object() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:30 +0100
Re: [PATCH 08/29] IB/mlx4: Delete an unnecessary check before the function call "kfree" in free_pv_object() Majd Dibbiny <majd@mellanox.com> - 2017-02-19 18:20 +0100
[PATCH 26/29] IB/mlx4: Enclose 14 expressions for the sizeof operator by parentheses SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:30 +0100
[PATCH 25/29] IB/mlx4: Add spaces for better code readability SF Markus Elfring <elfring@users.sourceforge.net> - 2017-02-18 22:50 +0100
Page 1 of 3 [1] 2 3 Next page →
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-02-18 21:50 +0100 |
| Subject | [PATCH 00/29] IB/mlx: Fine-tuning for several function implementations |
| Message-ID | <tck77-6Ef-3@gated-at.bofh.it> |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 18 Feb 2017 21:34:32 +0100 Several update suggestions were taken into account from static source code analysis. Markus Elfring (29): Use kcalloc() in mlx4_ib_alloc_pv_bufs() Improve another size determination in mlx4_ib_alloc_pv_bufs() Improve another size determination in mlx4_ib_alloc_demux_ctx() Improve another size determination in alloc_pv_object() Fix a typo in a comment line Delete three unnecessary return statements Split a condition check in handle_slaves_guid_change() Delete an unnecessary check before the function call "kfree" in free_pv_object() Move an assignment out of a check in forward_trap() Enclose 15 expressions for the sizeof operator by parentheses Use kmalloc_array() in three functions Enclose 17 expressions for the sizeof operator by parentheses Split a condition check in five functions Delete an unnecessary variable in __mlx4_ib_query_gid() Delete an unnecessary return statement in do_slave_init() Improve another size determination in do_slave_init() Improve another size determination in mlx4_ib_add() Delete an unnecessary variable initialisation in mlx4_ib_add() Delete an unnecessary variable assignment in mlx4_ib_add() Delete an error message for a failed memory allocation in mlx4_ib_add() Delete unnecessary braces in mlx4_ib_add() Use kmalloc_array() in alloc_proxy_bufs() Improve size determinations in create_qp_common() Delete unwanted spaces behind usages of the sizeof operator Add spaces for better code readability Enclose 14 expressions for the sizeof operator by parentheses Use kmalloc_array() in create_kernel_qp() Less function calls in create_kernel_qp() after error detection Use kmalloc_array() in create_srq_kernel() drivers/infiniband/hw/mlx4/mad.c | 72 ++++++++-------- drivers/infiniband/hw/mlx4/main.c | 164 ++++++++++++++++++++---------------- drivers/infiniband/hw/mlx4/qp.c | 173 +++++++++++++++++++------------------- drivers/infiniband/hw/mlx5/qp.c | 66 ++++++++++----- drivers/infiniband/hw/mlx5/srq.c | 5 +- 5 files changed, 261 insertions(+), 219 deletions(-) -- 2.11.1
[toc] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-02-18 22:00 +0100 |
| Subject | [PATCH 04/29] IB/mlx4: Improve another size determination in alloc_pv_object() |
| Message-ID | <tckgN-6HX-1@gated-at.bofh.it> |
| In reply to | #1583970 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Fri, 17 Feb 2017 20:20:43 +0100 Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" 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/hw/mlx4/mad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 284634d36b1c..ea4892b0f39e 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c @@ -1948,7 +1948,7 @@ static int alloc_pv_object(struct mlx4_ib_dev *dev, int slave, int port, struct mlx4_ib_demux_pv_ctx *ctx; *ret_ctx = NULL; - ctx = kzalloc(sizeof (struct mlx4_ib_demux_pv_ctx), GFP_KERNEL); + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); if (!ctx) return -ENOMEM; -- 2.11.1
[toc] | [prev] | [next] | [standalone]
| From | Majd Dibbiny <majd@mellanox.com> |
|---|---|
| Date | 2017-02-19 18:10 +0100 |
| Subject | Re: [PATCH 04/29] IB/mlx4: Improve another size determination in alloc_pv_object() |
| Message-ID | <tcD9M-1CL-31@gated-at.bofh.it> |
| In reply to | #1583972 |
> On Feb 18, 2017, at 10:52 PM, SF Markus Elfring <elfring@users.sourceforge.net> wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Fri, 17 Feb 2017 20:20:43 +0100 > > Replace the specification of a data structure by a pointer dereference > as the parameter for the operator "sizeof" 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/hw/mlx4/mad.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c > index 284634d36b1c..ea4892b0f39e 100644 > --- a/drivers/infiniband/hw/mlx4/mad.c > +++ b/drivers/infiniband/hw/mlx4/mad.c > @@ -1948,7 +1948,7 @@ static int alloc_pv_object(struct mlx4_ib_dev *dev, int slave, int port, > struct mlx4_ib_demux_pv_ctx *ctx; > > *ret_ctx = NULL; > - ctx = kzalloc(sizeof (struct mlx4_ib_demux_pv_ctx), GFP_KERNEL); > + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); > if (!ctx) > return -ENOMEM; > > -- > 2.11.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Thanks, Reviewed-by: Majd Dibbiny <majd@mellanox.com>
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-02-18 22:00 +0100 |
| Subject | [PATCH 01/29] IB/mlx4: Use kcalloc() in mlx4_ib_alloc_pv_bufs() |
| Message-ID | <tckgN-6HX-3@gated-at.bofh.it> |
| In reply to | #1583970 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Fri, 17 Feb 2017 20:00:34 +0100 * 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". This issue was detected by using the Coccinelle software. * 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/hw/mlx4/mad.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index db564ccc0f92..61bd81baeb29 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c @@ -1600,8 +1600,8 @@ static int mlx4_ib_alloc_pv_bufs(struct mlx4_ib_demux_pv_ctx *ctx, return -EINVAL; tun_qp = &ctx->qp[qp_type]; - - tun_qp->ring = kzalloc(sizeof (struct mlx4_ib_buf) * MLX4_NUM_TUNNEL_BUFS, + tun_qp->ring = kcalloc(MLX4_NUM_TUNNEL_BUFS, + sizeof(*tun_qp->ring), GFP_KERNEL); if (!tun_qp->ring) return -ENOMEM; -- 2.11.1
[toc] | [prev] | [next] | [standalone]
| From | Majd Dibbiny <majd@mellanox.com> |
|---|---|
| Date | 2017-02-19 18:10 +0100 |
| Subject | Re: [PATCH 01/29] IB/mlx4: Use kcalloc() in mlx4_ib_alloc_pv_bufs() |
| Message-ID | <tcD9M-1CL-27@gated-at.bofh.it> |
| In reply to | #1583973 |
> On Feb 18, 2017, at 10:55 PM, SF Markus Elfring <elfring@users.sourceforge.net> wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Fri, 17 Feb 2017 20:00:34 +0100 > > * 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". > > This issue was detected by using the Coccinelle software. > > * 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/hw/mlx4/mad.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c > index db564ccc0f92..61bd81baeb29 100644 > --- a/drivers/infiniband/hw/mlx4/mad.c > +++ b/drivers/infiniband/hw/mlx4/mad.c > @@ -1600,8 +1600,8 @@ static int mlx4_ib_alloc_pv_bufs(struct mlx4_ib_demux_pv_ctx *ctx, > return -EINVAL; > > tun_qp = &ctx->qp[qp_type]; > - > - tun_qp->ring = kzalloc(sizeof (struct mlx4_ib_buf) * MLX4_NUM_TUNNEL_BUFS, > + tun_qp->ring = kcalloc(MLX4_NUM_TUNNEL_BUFS, > + sizeof(*tun_qp->ring), > GFP_KERNEL); > if (!tun_qp->ring) > return -ENOMEM; > -- > 2.11.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Thanks, Reviewed-by: Majd Dibbiny <majd@mellanox.com>
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-02-18 22:00 +0100 |
| Subject | [PATCH 09/29] IB/mlx4: Move an assignment out of a check in forward_trap() |
| Message-ID | <tckgN-6HX-9@gated-at.bofh.it> |
| In reply to | #1583970 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Fri, 17 Feb 2017 22:22:53 +0100 The script "checkpatch.pl" pointed information out like the following. ERROR: do not use assignment in if condition Thus fix the affected source code place. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/infiniband/hw/mlx4/mad.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 9518b7244269..860fec8b9601 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c @@ -401,7 +401,8 @@ static void forward_trap(struct mlx4_ib_dev *dev, u8 port_num, const struct ib_m */ spin_lock_irqsave(&dev->sm_lock, flags); memcpy(send_buf->mad, mad, sizeof *mad); - if ((send_buf->ah = dev->sm_ah[port_num - 1])) + send_buf->ah = dev->sm_ah[port_num - 1]; + if (send_buf->ah) ret = ib_post_send_mad(send_buf, NULL); else ret = -EINVAL; -- 2.11.1
[toc] | [prev] | [next] | [standalone]
| From | Majd Dibbiny <majd@mellanox.com> |
|---|---|
| Date | 2017-02-19 18:20 +0100 |
| Subject | Re: [PATCH 09/29] IB/mlx4: Move an assignment out of a check in forward_trap() |
| Message-ID | <tcDjr-1Gc-9@gated-at.bofh.it> |
| In reply to | #1583975 |
> On Feb 18, 2017, at 10:58 PM, SF Markus Elfring <elfring@users.sourceforge.net> wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Fri, 17 Feb 2017 22:22:53 +0100 > > The script "checkpatch.pl" pointed information out like the following. > > ERROR: do not use assignment in if condition > > Thus fix the affected source code place. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > --- > drivers/infiniband/hw/mlx4/mad.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c > index 9518b7244269..860fec8b9601 100644 > --- a/drivers/infiniband/hw/mlx4/mad.c > +++ b/drivers/infiniband/hw/mlx4/mad.c > @@ -401,7 +401,8 @@ static void forward_trap(struct mlx4_ib_dev *dev, u8 port_num, const struct ib_m > */ > spin_lock_irqsave(&dev->sm_lock, flags); > memcpy(send_buf->mad, mad, sizeof *mad); > - if ((send_buf->ah = dev->sm_ah[port_num - 1])) > + send_buf->ah = dev->sm_ah[port_num - 1]; > + if (send_buf->ah) > ret = ib_post_send_mad(send_buf, NULL); > else > ret = -EINVAL; > -- > 2.11.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Thanks, Reviewed-by: Majd Dibbiny <majd@mellanox.com>
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-02-18 22:00 +0100 |
| Subject | [PATCH 03/29] IB/mlx4: Improve another size determination in mlx4_ib_alloc_demux_ctx() |
| Message-ID | <tckgO-6HX-11@gated-at.bofh.it> |
| In reply to | #1583970 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Fri, 17 Feb 2017 20:15:02 +0100 Replace the specification of a data type by a pointer dereference as the parameter for the operator "sizeof" 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/hw/mlx4/mad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 858da8746d49..284634d36b1c 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c @@ -2150,7 +2150,7 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev, int i; ctx->tun = kcalloc(dev->dev->caps.sqp_demux, - sizeof (struct mlx4_ib_demux_pv_ctx *), GFP_KERNEL); + sizeof(*ctx->tun), GFP_KERNEL); if (!ctx->tun) return -ENOMEM; -- 2.11.1
[toc] | [prev] | [next] | [standalone]
| From | Majd Dibbiny <majd@mellanox.com> |
|---|---|
| Date | 2017-02-19 18:10 +0100 |
| Subject | Re: [PATCH 03/29] IB/mlx4: Improve another size determination in mlx4_ib_alloc_demux_ctx() |
| Message-ID | <tcD9L-1CL-11@gated-at.bofh.it> |
| In reply to | #1583976 |
> On Feb 18, 2017, at 10:50 PM, SF Markus Elfring <elfring@users.sourceforge.net> wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Fri, 17 Feb 2017 20:15:02 +0100 > > Replace the specification of a data type by a pointer dereference > as the parameter for the operator "sizeof" 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/hw/mlx4/mad.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c > index 858da8746d49..284634d36b1c 100644 > --- a/drivers/infiniband/hw/mlx4/mad.c > +++ b/drivers/infiniband/hw/mlx4/mad.c > @@ -2150,7 +2150,7 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev, > int i; > > ctx->tun = kcalloc(dev->dev->caps.sqp_demux, > - sizeof (struct mlx4_ib_demux_pv_ctx *), GFP_KERNEL); > + sizeof(*ctx->tun), GFP_KERNEL); > if (!ctx->tun) > return -ENOMEM; > > -- > 2.11.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Thanks, Reviewed-by: Majd Dibbiny <majd@mellanox.com>
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-02-18 22:00 +0100 |
| Subject | [PATCH 06/29] IB/mlx4: Delete three unnecessary return statements |
| Message-ID | <tckgO-6HX-13@gated-at.bofh.it> |
| In reply to | #1583970 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Fri, 17 Feb 2017 21:34:27 +0100 The script "checkpatch.pl" pointed information out like the following. WARNING: void function return statements are not generally useful Thus remove such a statement in the affected functions. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/infiniband/hw/mlx4/mad.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index d8c27e3ed69a..cf33efce69d2 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c @@ -1173,7 +1173,6 @@ static void handle_slaves_guid_change(struct mlx4_ib_dev *dev, u8 port_num, out: kfree(in_mad); kfree(out_mad); - return; } void handle_port_mgmt_change_event(struct work_struct *work) @@ -2140,7 +2139,6 @@ void mlx4_ib_tunnels_update_work(struct work_struct *work) mlx4_ib_tunnels_update(dmxw->dev, dmxw->slave, (int) dmxw->port, dmxw->do_init); kfree(dmxw); - return; } static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev, @@ -2268,7 +2266,6 @@ static void mlx4_ib_master_tunnels(struct mlx4_ib_dev *dev, int do_init) /* initialize or tear down tunnel QPs for the master */ for (i = 0; i < dev->dev->caps.num_ports; i++) mlx4_ib_tunnels_update(dev, mlx4_master_func_num(dev->dev), i + 1, do_init); - return; } int mlx4_ib_init_sriov(struct mlx4_ib_dev *dev) -- 2.11.1
[toc] | [prev] | [next] | [standalone]
| From | Majd Dibbiny <majd@mellanox.com> |
|---|---|
| Date | 2017-02-19 18:10 +0100 |
| Subject | Re: [PATCH 06/29] IB/mlx4: Delete three unnecessary return statements |
| Message-ID | <tcD9M-1CL-23@gated-at.bofh.it> |
| In reply to | #1583977 |
> On Feb 18, 2017, at 10:54 PM, SF Markus Elfring <elfring@users.sourceforge.net> wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Fri, 17 Feb 2017 21:34:27 +0100 > > The script "checkpatch.pl" pointed information out like the following. > > WARNING: void function return statements are not generally useful > > Thus remove such a statement in the affected functions. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > --- > drivers/infiniband/hw/mlx4/mad.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c > index d8c27e3ed69a..cf33efce69d2 100644 > --- a/drivers/infiniband/hw/mlx4/mad.c > +++ b/drivers/infiniband/hw/mlx4/mad.c > @@ -1173,7 +1173,6 @@ static void handle_slaves_guid_change(struct mlx4_ib_dev *dev, u8 port_num, > out: > kfree(in_mad); > kfree(out_mad); > - return; > } > > void handle_port_mgmt_change_event(struct work_struct *work) > @@ -2140,7 +2139,6 @@ void mlx4_ib_tunnels_update_work(struct work_struct *work) > mlx4_ib_tunnels_update(dmxw->dev, dmxw->slave, (int) dmxw->port, > dmxw->do_init); > kfree(dmxw); > - return; > } > > static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev, > @@ -2268,7 +2266,6 @@ static void mlx4_ib_master_tunnels(struct mlx4_ib_dev *dev, int do_init) > /* initialize or tear down tunnel QPs for the master */ > for (i = 0; i < dev->dev->caps.num_ports; i++) > mlx4_ib_tunnels_update(dev, mlx4_master_func_num(dev->dev), i + 1, do_init); > - return; > } > > int mlx4_ib_init_sriov(struct mlx4_ib_dev *dev) > -- > 2.11.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Thanks, Reviewed-by: Majd Dibbiny <majd@mellanox.com>
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-02-18 22:00 +0100 |
| Subject | [PATCH 05/29] IB/mlx4: Fix a typo in a comment line |
| Message-ID | <tckgO-6HX-15@gated-at.bofh.it> |
| In reply to | #1583970 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Fri, 17 Feb 2017 20:48:59 +0100 Add a missing character in this description and adjust the comment formatting. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/infiniband/hw/mlx4/mad.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index ea4892b0f39e..d8c27e3ed69a 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c @@ -1559,8 +1559,10 @@ static void mlx4_ib_multiplex_mad(struct mlx4_ib_demux_pv_ctx *ctx, struct ib_wc } } - /* We are using standard ib_core services to send the mad, so generate a - * stadard address handle by decoding the tunnelled mlx4_ah fields */ + /* + * We are using standard ib_core services to send the mad, so generate + * a standard address handle by decoding the tunnelled mlx4_ah fields. + */ memcpy(&ah.av, &tunnel->hdr.av, sizeof (struct mlx4_av)); ah.ibah.device = ctx->ib_dev; -- 2.11.1
[toc] | [prev] | [next] | [standalone]
| From | Majd Dibbiny <majd@mellanox.com> |
|---|---|
| Date | 2017-02-19 18:10 +0100 |
| Subject | Re: [PATCH 05/29] IB/mlx4: Fix a typo in a comment line |
| Message-ID | <tcD9L-1CL-7@gated-at.bofh.it> |
| In reply to | #1583978 |
> On Feb 18, 2017, at 10:53 PM, SF Markus Elfring <elfring@users.sourceforge.net> wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Fri, 17 Feb 2017 20:48:59 +0100 > > Add a missing character in this description and adjust > the comment formatting. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > --- > drivers/infiniband/hw/mlx4/mad.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c > index ea4892b0f39e..d8c27e3ed69a 100644 > --- a/drivers/infiniband/hw/mlx4/mad.c > +++ b/drivers/infiniband/hw/mlx4/mad.c > @@ -1559,8 +1559,10 @@ static void mlx4_ib_multiplex_mad(struct mlx4_ib_demux_pv_ctx *ctx, struct ib_wc > } > } > > - /* We are using standard ib_core services to send the mad, so generate a > - * stadard address handle by decoding the tunnelled mlx4_ah fields */ > + /* > + * We are using standard ib_core services to send the mad, so generate > + * a standard address handle by decoding the tunnelled mlx4_ah fields. > + */ > memcpy(&ah.av, &tunnel->hdr.av, sizeof (struct mlx4_av)); > ah.ibah.device = ctx->ib_dev; > > -- > 2.11.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Thanks, Reviewed-by: Majd Dibbiny <majd@mellanox.com>
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-02-18 22:00 +0100 |
| Subject | [PATCH 07/29] IB/mlx4: Split a condition check in handle_slaves_guid_change() |
| Message-ID | <tckgO-6HX-19@gated-at.bofh.it> |
| In reply to | #1583970 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 17 Feb 2017 21:41:25 +0100
The kfree() function was called in up to two cases by the
handle_slaves_guid_change() function during error handling even if
the passed variable contained a null pointer.
* Split a condition check for memory allocation failures.
* Adjust jump targets according to the Linux coding style convention.
* Delete an initialisation for these variables at the beginning
which became unnecessary with this refactoring.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/infiniband/hw/mlx4/mad.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index cf33efce69d2..75b6522b3a8f 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -1128,17 +1128,20 @@ static void propagate_pkey_ev(struct mlx4_ib_dev *dev, int port_num,
static void handle_slaves_guid_change(struct mlx4_ib_dev *dev, u8 port_num,
u32 guid_tbl_blk_num, u32 change_bitmap)
{
- struct ib_smp *in_mad = NULL;
- struct ib_smp *out_mad = NULL;
+ struct ib_smp *in_mad;
+ struct ib_smp *out_mad;
u16 i;
if (!mlx4_is_mfunc(dev->dev) || !mlx4_is_master(dev->dev))
return;
in_mad = kmalloc(sizeof *in_mad, GFP_KERNEL);
+ if (!in_mad)
+ return;
+
out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
- if (!in_mad || !out_mad)
- goto out;
+ if (!out_mad)
+ goto free_in_mad;
guid_tbl_blk_num *= 4;
@@ -1171,8 +1174,9 @@ static void handle_slaves_guid_change(struct mlx4_ib_dev *dev, u8 port_num,
}
out:
- kfree(in_mad);
kfree(out_mad);
+free_in_mad:
+ kfree(in_mad);
}
void handle_port_mgmt_change_event(struct work_struct *work)
--
2.11.1
[toc] | [prev] | [next] | [standalone]
| From | Majd Dibbiny <majd@mellanox.com> |
|---|---|
| Date | 2017-02-19 18:10 +0100 |
| Subject | Re: [PATCH 07/29] IB/mlx4: Split a condition check in handle_slaves_guid_change() |
| Message-ID | <tcD9M-1CL-19@gated-at.bofh.it> |
| In reply to | #1583980 |
> On Feb 18, 2017, at 10:55 PM, SF Markus Elfring <elfring@users.sourceforge.net> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 17 Feb 2017 21:41:25 +0100
>
> The kfree() function was called in up to two cases by the
> handle_slaves_guid_change() function during error handling even if
> the passed variable contained a null pointer.
>
> * Split a condition check for memory allocation failures.
>
> * Adjust jump targets according to the Linux coding style convention.
>
> * Delete an initialisation for these variables at the beginning
> which became unnecessary with this refactoring.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> drivers/infiniband/hw/mlx4/mad.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
> index cf33efce69d2..75b6522b3a8f 100644
> --- a/drivers/infiniband/hw/mlx4/mad.c
> +++ b/drivers/infiniband/hw/mlx4/mad.c
> @@ -1128,17 +1128,20 @@ static void propagate_pkey_ev(struct mlx4_ib_dev *dev, int port_num,
> static void handle_slaves_guid_change(struct mlx4_ib_dev *dev, u8 port_num,
> u32 guid_tbl_blk_num, u32 change_bitmap)
> {
> - struct ib_smp *in_mad = NULL;
> - struct ib_smp *out_mad = NULL;
> + struct ib_smp *in_mad;
> + struct ib_smp *out_mad;
> u16 i;
>
> if (!mlx4_is_mfunc(dev->dev) || !mlx4_is_master(dev->dev))
> return;
>
> in_mad = kmalloc(sizeof *in_mad, GFP_KERNEL);
> + if (!in_mad)
> + return;
> +
> out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
> - if (!in_mad || !out_mad)
> - goto out;
> + if (!out_mad)
> + goto free_in_mad;
>
> guid_tbl_blk_num *= 4;
>
> @@ -1171,8 +1174,9 @@ static void handle_slaves_guid_change(struct mlx4_ib_dev *dev, u8 port_num,
> }
>
> out:
> - kfree(in_mad);
> kfree(out_mad);
> +free_in_mad:
> + kfree(in_mad);
> }
>
> void handle_port_mgmt_change_event(struct work_struct *work)
> --
> 2.11.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks,
Reviewed-by: Majd Dibbiny
<majd@mellanox.com>
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-02-18 22:00 +0100 |
| Subject | [PATCH 10/29] IB/mlx4: Enclose 15 expressions for the sizeof operator by parentheses |
| Message-ID | <tckgO-6HX-25@gated-at.bofh.it> |
| In reply to | #1583970 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 18 Feb 2017 09:54:15 +0100
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/hw/mlx4/mad.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index 860fec8b9601..b26817f0669f 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -195,7 +195,7 @@ static void update_sm_ah(struct mlx4_ib_dev *dev, u8 port_num, u16 lid, u8 sl)
if (!dev->send_agent[port_num - 1][0])
return;
- memset(&ah_attr, 0, sizeof ah_attr);
+ memset(&ah_attr, 0, sizeof(ah_attr));
ah_attr.dlid = lid;
ah_attr.sl = sl;
ah_attr.port_num = port_num;
@@ -400,7 +400,7 @@ static void forward_trap(struct mlx4_ib_dev *dev, u8 port_num, const struct ib_m
* it's OK for our devices).
*/
spin_lock_irqsave(&dev->sm_lock, flags);
- memcpy(send_buf->mad, mad, sizeof *mad);
+ memcpy(send_buf->mad, mad, sizeof(*mad));
send_buf->ah = dev->sm_ah[port_num - 1];
if (send_buf->ah)
ret = ib_post_send_mad(send_buf, NULL);
@@ -555,7 +555,7 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port,
/* create ah. Just need an empty one with the port num for the post send.
* The driver will set the force loopback bit in post_send */
- memset(&attr, 0, sizeof attr);
+ memset(&attr, 0, sizeof(attr));
attr.port_num = port;
if (is_eth) {
union ib_gid sgid;
@@ -590,8 +590,8 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port,
/* copy over to tunnel buffer */
if (grh)
- memcpy(&tun_mad->grh, grh, sizeof *grh);
- memcpy(&tun_mad->mad, mad, sizeof *mad);
+ memcpy(&tun_mad->grh, grh, sizeof(*grh));
+ memcpy(&tun_mad->mad, mad, sizeof(*mad));
/* adjust tunnel data */
tun_mad->hdr.pkey_index = cpu_to_be16(tun_pkey_ix);
@@ -961,7 +961,7 @@ static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
}
mutex_unlock(&dev->counters_table[port_num - 1].mutex);
if (stats_avail) {
- memset(out_mad->data, 0, sizeof out_mad->data);
+ memset(out_mad->data, 0, sizeof(out_mad->data));
switch (counter_stats.counter_mode & 0xf) {
case 0:
edit_counter(&counter_stats,
@@ -1136,11 +1136,11 @@ static void handle_slaves_guid_change(struct mlx4_ib_dev *dev, u8 port_num,
if (!mlx4_is_mfunc(dev->dev) || !mlx4_is_master(dev->dev))
return;
- in_mad = kmalloc(sizeof *in_mad, GFP_KERNEL);
+ in_mad = kmalloc(sizeof(*in_mad), GFP_KERNEL);
if (!in_mad)
return;
- out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
+ out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL);
if (!out_mad)
goto free_in_mad;
@@ -1149,8 +1149,8 @@ static void handle_slaves_guid_change(struct mlx4_ib_dev *dev, u8 port_num,
for (i = 0; i < 4; i++) {
if (change_bitmap && (!((change_bitmap >> (8 * i)) & 0xff)))
continue;
- memset(in_mad, 0, sizeof *in_mad);
- memset(out_mad, 0, sizeof *out_mad);
+ memset(in_mad, 0, sizeof(*in_mad));
+ memset(out_mad, 0, sizeof(*out_mad));
in_mad->base_version = 1;
in_mad->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED;
@@ -1421,7 +1421,7 @@ int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u8 port,
sizeof (struct mlx4_mad_snd_buf),
DMA_TO_DEVICE);
- memcpy(&sqp_mad->payload, mad, sizeof *mad);
+ memcpy(&sqp_mad->payload, mad, sizeof(*mad));
ib_dma_sync_single_for_device(&dev->ib_dev,
sqp->tx_ring[wire_tx_ix].buf.map,
@@ -1804,7 +1804,7 @@ static int create_pv_sqp(struct mlx4_ib_demux_pv_ctx *ctx,
tun_qp = &ctx->qp[qp_type];
- memset(&qp_init_attr, 0, sizeof qp_init_attr);
+ memset(&qp_init_attr, 0, sizeof(qp_init_attr));
qp_init_attr.init_attr.send_cq = ctx->cq;
qp_init_attr.init_attr.recv_cq = ctx->cq;
qp_init_attr.init_attr.sq_sig_type = IB_SIGNAL_ALL_WR;
@@ -1837,7 +1837,7 @@ static int create_pv_sqp(struct mlx4_ib_demux_pv_ctx *ctx,
return ret;
}
- memset(&attr, 0, sizeof attr);
+ memset(&attr, 0, sizeof(attr));
attr.qp_state = IB_QPS_INIT;
ret = 0;
if (create_tun)
@@ -2184,7 +2184,7 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev,
goto err_mcg;
}
- snprintf(name, sizeof name, "mlx4_ibt%d", port);
+ snprintf(name, sizeof(name), "mlx4_ibt%d", port);
ctx->wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM);
if (!ctx->wq) {
pr_err("Failed to create tunnelling WQ for port %d\n", port);
@@ -2192,7 +2192,7 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev,
goto err_wq;
}
- snprintf(name, sizeof name, "mlx4_ibud%d", port);
+ snprintf(name, sizeof(name), "mlx4_ibud%d", port);
ctx->ud_wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM);
if (!ctx->ud_wq) {
pr_err("Failed to create up/down WQ for port %d\n", port);
--
2.11.1
[toc] | [prev] | [next] | [standalone]
| From | Majd Dibbiny <majd@mellanox.com> |
|---|---|
| Date | 2017-02-19 18:30 +0100 |
| Subject | Re: [PATCH 10/29] IB/mlx4: Enclose 15 expressions for the sizeof operator by parentheses |
| Message-ID | <tcDt8-1Jy-35@gated-at.bofh.it> |
| In reply to | #1583981 |
> On Feb 18, 2017, at 10:59 PM, SF Markus Elfring <elfring@users.sourceforge.net> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 18 Feb 2017 09:54:15 +0100
> 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/hw/mlx4/mad.c | 30 +++++++++++++++---------------
> 1 file changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
> index 860fec8b9601..b26817f0669f 100644
> --- a/drivers/infiniband/hw/mlx4/mad.c
> +++ b/drivers/infiniband/hw/mlx4/mad.c
> @@ -195,7 +195,7 @@ static void update_sm_ah(struct mlx4_ib_dev *dev, u8 port_num, u16 lid, u8 sl)
> if (!dev->send_agent[port_num - 1][0])
> return;
>
> - memset(&ah_attr, 0, sizeof ah_attr);
> + memset(&ah_attr, 0, sizeof(ah_attr));
> ah_attr.dlid = lid;
> ah_attr.sl = sl;
> ah_attr.port_num = port_num;
> @@ -400,7 +400,7 @@ static void forward_trap(struct mlx4_ib_dev *dev, u8 port_num, const struct ib_m
> * it's OK for our devices).
> */
> spin_lock_irqsave(&dev->sm_lock, flags);
> - memcpy(send_buf->mad, mad, sizeof *mad);
> + memcpy(send_buf->mad, mad, sizeof(*mad));
> send_buf->ah = dev->sm_ah[port_num - 1];
> if (send_buf->ah)
> ret = ib_post_send_mad(send_buf, NULL);
> @@ -555,7 +555,7 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port,
>
> /* create ah. Just need an empty one with the port num for the post send.
> * The driver will set the force loopback bit in post_send */
> - memset(&attr, 0, sizeof attr);
> + memset(&attr, 0, sizeof(attr));
> attr.port_num = port;
> if (is_eth) {
> union ib_gid sgid;
> @@ -590,8 +590,8 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port,
>
> /* copy over to tunnel buffer */
> if (grh)
> - memcpy(&tun_mad->grh, grh, sizeof *grh);
> - memcpy(&tun_mad->mad, mad, sizeof *mad);
> + memcpy(&tun_mad->grh, grh, sizeof(*grh));
> + memcpy(&tun_mad->mad, mad, sizeof(*mad));
>
> /* adjust tunnel data */
> tun_mad->hdr.pkey_index = cpu_to_be16(tun_pkey_ix);
> @@ -961,7 +961,7 @@ static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
> }
> mutex_unlock(&dev->counters_table[port_num - 1].mutex);
> if (stats_avail) {
> - memset(out_mad->data, 0, sizeof out_mad->data);
> + memset(out_mad->data, 0, sizeof(out_mad->data));
> switch (counter_stats.counter_mode & 0xf) {
> case 0:
> edit_counter(&counter_stats,
> @@ -1136,11 +1136,11 @@ static void handle_slaves_guid_change(struct mlx4_ib_dev *dev, u8 port_num,
> if (!mlx4_is_mfunc(dev->dev) || !mlx4_is_master(dev->dev))
> return;
>
> - in_mad = kmalloc(sizeof *in_mad, GFP_KERNEL);
> + in_mad = kmalloc(sizeof(*in_mad), GFP_KERNEL);
> if (!in_mad)
> return;
>
> - out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
> + out_mad = kmalloc(sizeof(*out_mad), GFP_KERNEL);
> if (!out_mad)
> goto free_in_mad;
>
> @@ -1149,8 +1149,8 @@ static void handle_slaves_guid_change(struct mlx4_ib_dev *dev, u8 port_num,
> for (i = 0; i < 4; i++) {
> if (change_bitmap && (!((change_bitmap >> (8 * i)) & 0xff)))
> continue;
> - memset(in_mad, 0, sizeof *in_mad);
> - memset(out_mad, 0, sizeof *out_mad);
> + memset(in_mad, 0, sizeof(*in_mad));
> + memset(out_mad, 0, sizeof(*out_mad));
>
> in_mad->base_version = 1;
> in_mad->mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED;
> @@ -1421,7 +1421,7 @@ int mlx4_ib_send_to_wire(struct mlx4_ib_dev *dev, int slave, u8 port,
> sizeof (struct mlx4_mad_snd_buf),
> DMA_TO_DEVICE);
>
> - memcpy(&sqp_mad->payload, mad, sizeof *mad);
> + memcpy(&sqp_mad->payload, mad, sizeof(*mad));
>
> ib_dma_sync_single_for_device(&dev->ib_dev,
> sqp->tx_ring[wire_tx_ix].buf.map,
> @@ -1804,7 +1804,7 @@ static int create_pv_sqp(struct mlx4_ib_demux_pv_ctx *ctx,
>
> tun_qp = &ctx->qp[qp_type];
>
> - memset(&qp_init_attr, 0, sizeof qp_init_attr);
> + memset(&qp_init_attr, 0, sizeof(qp_init_attr));
> qp_init_attr.init_attr.send_cq = ctx->cq;
> qp_init_attr.init_attr.recv_cq = ctx->cq;
> qp_init_attr.init_attr.sq_sig_type = IB_SIGNAL_ALL_WR;
> @@ -1837,7 +1837,7 @@ static int create_pv_sqp(struct mlx4_ib_demux_pv_ctx *ctx,
> return ret;
> }
>
> - memset(&attr, 0, sizeof attr);
> + memset(&attr, 0, sizeof(attr));
> attr.qp_state = IB_QPS_INIT;
> ret = 0;
> if (create_tun)
> @@ -2184,7 +2184,7 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev,
> goto err_mcg;
> }
>
> - snprintf(name, sizeof name, "mlx4_ibt%d", port);
> + snprintf(name, sizeof(name), "mlx4_ibt%d", port);
> ctx->wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM);
> if (!ctx->wq) {
> pr_err("Failed to create tunnelling WQ for port %d\n", port);
> @@ -2192,7 +2192,7 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev,
> goto err_wq;
> }
>
> - snprintf(name, sizeof name, "mlx4_ibud%d", port);
> + snprintf(name, sizeof(name), "mlx4_ibud%d", port);
> ctx->ud_wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM);
> if (!ctx->ud_wq) {
> pr_err("Failed to create up/down WQ for port %d\n", port);
> --
> 2.11.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks,
Reviewed-by: Majd Dibbiny
<majd@mellanox.com>
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-02-18 22:10 +0100 |
| Subject | [PATCH 15/29] IB/mlx4: Delete an unnecessary return statement in do_slave_init() |
| Message-ID | <tckqt-70u-1@gated-at.bofh.it> |
| In reply to | #1583970 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Sat, 18 Feb 2017 15:16:54 +0100 The script "checkpatch.pl" pointed information out like the following. WARNING: void function return statements are not generally useful Thus remove such a statement here. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- drivers/infiniband/hw/mlx4/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 89bbb61d62f5..b2b472977a39 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c @@ -3131,7 +3131,6 @@ static void do_slave_init(struct mlx4_ib_dev *ibdev, int slave, int do_init) } out: kfree(dm); - return; } static void mlx4_ib_handle_catas_error(struct mlx4_ib_dev *ibdev) -- 2.11.1
[toc] | [prev] | [next] | [standalone]
| From | Majd Dibbiny <majd@mellanox.com> |
|---|---|
| Date | 2017-02-19 23:40 +0100 |
| Subject | Re: [PATCH 15/29] IB/mlx4: Delete an unnecessary return statement in do_slave_init() |
| Message-ID | <tcIj8-4Ho-13@gated-at.bofh.it> |
| In reply to | #1583982 |
> On Feb 18, 2017, at 11:04 PM, SF Markus Elfring <elfring@users.sourceforge.net> wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Sat, 18 Feb 2017 15:16:54 +0100 > > The script "checkpatch.pl" pointed information out like the following. > > WARNING: void function return statements are not generally useful > > Thus remove such a statement here. > > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> > --- > drivers/infiniband/hw/mlx4/main.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c > index 89bbb61d62f5..b2b472977a39 100644 > --- a/drivers/infiniband/hw/mlx4/main.c > +++ b/drivers/infiniband/hw/mlx4/main.c > @@ -3131,7 +3131,6 @@ static void do_slave_init(struct mlx4_ib_dev *ibdev, int slave, int do_init) > } > out: > kfree(dm); > - return; > } > > static void mlx4_ib_handle_catas_error(struct mlx4_ib_dev *ibdev) > -- > 2.11.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Thanks, Reviewed-by: Majd Dibbiny <majd@mellanox.com>
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-02-18 22:10 +0100 |
| Subject | [PATCH 11/29] IB/mlx4: Use kmalloc_array() in three functions |
| Message-ID | <tckqt-70u-3@gated-at.bofh.it> |
| In reply to | #1583970 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 18 Feb 2017 10:32:32 +0100
Multiplications for the size determination of memory allocations
indicated that array data structures should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/infiniband/hw/mlx4/main.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index ba6af84cc236..350c9148340e 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -304,7 +304,9 @@ static int mlx4_ib_add_gid(struct ib_device *device,
ctx->refcount++;
}
if (!ret && hw_update) {
- gids = kmalloc(sizeof(*gids) * MLX4_MAX_PORT_GIDS, GFP_ATOMIC);
+ gids = kmalloc_array(MLX4_MAX_PORT_GIDS,
+ sizeof(*gids),
+ GFP_ATOMIC);
if (!gids) {
ret = -ENOMEM;
} else {
@@ -359,7 +361,9 @@ static int mlx4_ib_del_gid(struct ib_device *device,
if (!ret && hw_update) {
int i;
- gids = kmalloc(sizeof(*gids) * MLX4_MAX_PORT_GIDS, GFP_ATOMIC);
+ gids = kmalloc_array(MLX4_MAX_PORT_GIDS,
+ sizeof(*gids),
+ GFP_ATOMIC);
if (!gids) {
ret = -ENOMEM;
} else {
@@ -2828,9 +2832,9 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
goto err_counter;
ibdev->ib_uc_qpns_bitmap =
- kmalloc(BITS_TO_LONGS(ibdev->steer_qpn_count) *
- sizeof(long),
- GFP_KERNEL);
+ kmalloc_array(BITS_TO_LONGS(ibdev->steer_qpn_count),
+ sizeof(long),
+ GFP_KERNEL);
if (!ibdev->ib_uc_qpns_bitmap)
goto err_steer_qp_release;
--
2.11.1
[toc] | [prev] | [next] | [standalone]
Page 1 of 3 [1] 2 3 Next page →
Back to top | Article view | linux.kernel
csiph-web