diff mbox series

[v2] Fix one error in mthca_alloc

Message ID 20210826142828.9169-1-kangning18z@ict.ac.cn (mailing list archive)
State Superseded
Headers show
Series [v2] Fix one error in mthca_alloc | expand

Commit Message

kangning18z@ict.ac.cn Aug. 26, 2021, 2:28 p.m. UTC
drivers/infiniband/hw/mthca/mthca_allocator.c: alloc->last left unchanged in mthca_alloc, which
has impact on performance of function find_next_zero_bit in mthca_alloc. And the parenthesis and
braces are removed in this version.

Signed-off-by: kangning <kangning18z@ict.ac.cn>
---
 Thanks for your review, and the parenthesis and braces have been removed in this version.

 drivers/infiniband/hw/mthca/mthca_allocator.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Haakon Bugge Aug. 26, 2021, 2:39 p.m. UTC | #1
> On 26 Aug 2021, at 16:28, kangning <kangning18z@ict.ac.cn> wrote:
> 
> drivers/infiniband/hw/mthca/mthca_allocator.c: alloc->last left unchanged in mthca_alloc, which
> has impact on performance of function find_next_zero_bit in mthca_alloc. And the parenthesis and
> braces are removed in this version.
> 
> Signed-off-by: kangning <kangning18z@ict.ac.cn>

You made the right fix for my comments :-) But you made another commit, based on you first one. Easy mistake. Please send a v3 where you squash the two together into one commit.


Thxs, HÃ¥kon

> ---
> Thanks for your review, and the parenthesis and braces have been removed in this version.
> 
> drivers/infiniband/hw/mthca/mthca_allocator.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mthca/mthca_allocator.c b/drivers/infiniband/hw/mthca/mthca_allocator.c
> index e81bb0fcd08e..1141695093e7 100644
> --- a/drivers/infiniband/hw/mthca/mthca_allocator.c
> +++ b/drivers/infiniband/hw/mthca/mthca_allocator.c
> @@ -51,10 +51,9 @@ u32 mthca_alloc(struct mthca_alloc *alloc)
> 	}
> 
> 	if (obj < alloc->max) {
> -		alloc->last = (obj + 1);
> -		if (alloc->last == alloc->max) {
> +		alloc->last = obj + 1;
> +		if (alloc->last == alloc->max)
> 			alloc->last = 0;
> -		}
> 		set_bit(obj, alloc->table);
> 		obj |= alloc->top;
> 	} else
> -- 
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/mthca/mthca_allocator.c b/drivers/infiniband/hw/mthca/mthca_allocator.c
index e81bb0fcd08e..1141695093e7 100644
--- a/drivers/infiniband/hw/mthca/mthca_allocator.c
+++ b/drivers/infiniband/hw/mthca/mthca_allocator.c
@@ -51,10 +51,9 @@  u32 mthca_alloc(struct mthca_alloc *alloc)
 	}
 
 	if (obj < alloc->max) {
-		alloc->last = (obj + 1);
-		if (alloc->last == alloc->max) {
+		alloc->last = obj + 1;
+		if (alloc->last == alloc->max)
 			alloc->last = 0;
-		}
 		set_bit(obj, alloc->table);
 		obj |= alloc->top;
 	} else