Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1628492
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 10/17] IB/mlx4: Delete an unnecessary variable in __mlx4_ib_query_gid() |
| Date | 2017-04-21 20:50 +0200 |
| Message-ID | <tyLN0-Pg-29@gated-at.bofh.it> (permalink) |
| References | <tck77-6Ef-3@gated-at.bofh.it> <tyr1U-565-17@gated-at.bofh.it> <tyLtE-Ix-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 21 Apr 2017 18:22:42 +0200
* Call the function "memset" directly in an if branch without using
an intermediate variable.
* Delete the local variable "clear" which became unnecessary with
this refactoring.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/infiniband/hw/mlx4/main.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index e18e46a68809..a54e2f04929b 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -780,7 +780,6 @@ int __mlx4_ib_query_gid(struct ib_device *ibdev, u8 port, int index,
struct ib_smp *out_mad;
int err;
struct mlx4_ib_dev *dev = to_mdev(ibdev);
- int clear = 0;
int mad_ifc_flags = MLX4_MAD_IFC_IGNORE_KEYS;
in_mad = kzalloc(sizeof(*in_mad), GFP_KERNEL);
@@ -809,8 +808,8 @@ int __mlx4_ib_query_gid(struct ib_device *ibdev, u8 port, int index,
if (mlx4_is_mfunc(dev->dev) && !netw_view) {
if (index) {
/* For any index > 0, return the null guid */
+ memset(gid->raw + 8, 0, 8);
err = 0;
- clear = 1;
goto out;
}
}
@@ -827,8 +826,6 @@ int __mlx4_ib_query_gid(struct ib_device *ibdev, u8 port, int index,
memcpy(gid->raw + 8, out_mad->data + (index % 8) * 8, 8);
out:
- if (clear)
- memset(gid->raw + 8, 0, 8);
kfree(out_mad);
free_in_mad:
kfree(in_mad);
--
2.12.2
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH 00/29] IB/mlx: Fine-tuning for several function implementations Doug Ledford <dledford@redhat.com> - 2017-04-20 22:40 +0200
Re: [PATCH 00/29] IB/mlx: Fine-tuning for several function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-20 23:10 +0200
Re: [PATCH 00/29] IB/mlx: Fine-tuning for several function implementations Doug Ledford <dledford@redhat.com> - 2017-04-21 04:30 +0200
[PATCH v2 02/17] IB/mlx: Use kmalloc_array() in six functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 20:30 +0200
[PATCH v2 00/17] IB/mlx: Fine-tuning for several function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 20:30 +0200
[PATCH v2 01/17] IB/mlx4: Use kcalloc() in mlx4_ib_alloc_pv_bufs() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 20:30 +0200
[PATCH v2 07/17] IB/mlx4: Move an assignment out of a check in forward_trap() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 20:40 +0200
[PATCH v2 05/17] IB/mlx4: Delete four unnecessary return statements SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 20:40 +0200
[PATCH v2 08/17] IB/mlx4: Enclose 46 expressions for sizeof by parentheses SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 20:40 +0200
[PATCH v2 04/17] IB/mlx4: Fix a typo in a comment line SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 20:40 +0200
[PATCH v2 06/17] IB/mlx4: Delete an unnecessary check before kfree() in free_pv_object() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 20:40 +0200
[PATCH v2 03/17] IB/mlx4: Improve size determinations in six functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 20:40 +0200
Re: [PATCH v2 00/17] IB/mlx: Fine-tuning for several function implementations Bart Van Assche <Bart.VanAssche@sandisk.com> - 2017-04-21 20:40 +0200
Re: IB/mlx: Fine-tuning for several function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 21:30 +0200
Re: IB/mlx: Fine-tuning for several function implementations Bart Van Assche <Bart.VanAssche@sandisk.com> - 2017-04-21 22:00 +0200
[PATCH v2 12/17] IB/mlx4: Delete an unnecessary variable assignment in mlx4_ib_add() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 20:50 +0200
[PATCH v2 13/17] IB/mlx4: Delete an error message for a failed memory allocation in mlx4_ib_add() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 20:50 +0200
[PATCH v2 11/17] IB/mlx4: Delete an unnecessary variable initialisation in mlx4_ib_add() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 20:50 +0200
[PATCH v2 10/17] IB/mlx4: Delete an unnecessary variable in __mlx4_ib_query_gid() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 20:50 +0200
[PATCH v2 09/17] IB/mlx4: Split a condition check in six functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 20:50 +0200
[PATCH v2 17/17] IB/mlx5: Less function calls in create_kernel_qp() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 21:00 +0200
[PATCH v2 16/17] IB/mlx4: Add spaces for better code readability SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 21:00 +0200
Re: [PATCH v2 16/17] IB/mlx4: Add spaces for better code readability Joe Perches <joe@perches.com> - 2017-04-21 21:30 +0200
[PATCH v2 14/17] IB/mlx4: Delete unnecessary braces in mlx4_ib_add() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 21:00 +0200
[PATCH v2 15/17] IB/mlx4: Delete unwanted spaces behind usages of the sizeof operator SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-21 21:00 +0200
csiph-web