Message ID | 1499841873-10275-1-git-send-email-yanjun.zhu@oracle.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
On Wed, Jul 12, 2017 at 02:44:33AM -0400, Zhu Yanjun wrote: > The function __mlx4_zone_remove_one_entry always returns zero. So > it is not necessary to check it. > > Cc: Joe Jin <joe.jin@oracle.com> > Cc: Junxiao Bi <junxiao.bi@oracle.com> > Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com> > --- > drivers/net/ethernet/mellanox/mlx4/alloc.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/ethernet/mellanox/mlx4/alloc.c b/drivers/net/ethernet/mellanox/mlx4/alloc.c > index 249a458..bfb185d 100644 > --- a/drivers/net/ethernet/mellanox/mlx4/alloc.c > +++ b/drivers/net/ethernet/mellanox/mlx4/alloc.c > @@ -283,7 +283,7 @@ int mlx4_zone_add_one(struct mlx4_zone_allocator *zone_alloc, > } > > /* Should be called under a lock */ > -static int __mlx4_zone_remove_one_entry(struct mlx4_zone_entry *entry) > +static void __mlx4_zone_remove_one_entry(struct mlx4_zone_entry *entry) > { > struct mlx4_zone_allocator *zone_alloc = entry->allocator; > > @@ -315,8 +315,6 @@ static int __mlx4_zone_remove_one_entry(struct mlx4_zone_entry *entry) > } > zone_alloc->mask = mask; > } > - > - return 0; > } > > void mlx4_zone_allocator_destroy(struct mlx4_zone_allocator *zone_alloc) > @@ -468,7 +466,8 @@ int mlx4_zone_remove_one(struct mlx4_zone_allocator *zones, u32 uid) > goto out; > } > > - res = __mlx4_zone_remove_one_entry(zone); > + __mlx4_zone_remove_one_entry(zone); > + res = 0; Will look better if initialization will move to variable declaration. Besides this minor thing - lgtm. Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com> > > out: > spin_unlock(&zones->lock); > -- > 2.7.4 > -- 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
On Wed, Jul 12, 2017 at 11:36:48AM +0300, Yuval Shaia wrote: > On Wed, Jul 12, 2017 at 02:44:33AM -0400, Zhu Yanjun wrote: > > The function __mlx4_zone_remove_one_entry always returns zero. So > > it is not necessary to check it. > > > > Cc: Joe Jin <joe.jin@oracle.com> > > Cc: Junxiao Bi <junxiao.bi@oracle.com> > > Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com> > > --- > > drivers/net/ethernet/mellanox/mlx4/alloc.c | 7 +++---- > > 1 file changed, 3 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/net/ethernet/mellanox/mlx4/alloc.c b/drivers/net/ethernet/mellanox/mlx4/alloc.c > > index 249a458..bfb185d 100644 > > --- a/drivers/net/ethernet/mellanox/mlx4/alloc.c > > +++ b/drivers/net/ethernet/mellanox/mlx4/alloc.c > > @@ -283,7 +283,7 @@ int mlx4_zone_add_one(struct mlx4_zone_allocator *zone_alloc, > > } > > > > /* Should be called under a lock */ > > -static int __mlx4_zone_remove_one_entry(struct mlx4_zone_entry *entry) > > +static void __mlx4_zone_remove_one_entry(struct mlx4_zone_entry *entry) > > { > > struct mlx4_zone_allocator *zone_alloc = entry->allocator; > > > > @@ -315,8 +315,6 @@ static int __mlx4_zone_remove_one_entry(struct mlx4_zone_entry *entry) > > } > > zone_alloc->mask = mask; > > } > > - > > - return 0; > > } > > > > void mlx4_zone_allocator_destroy(struct mlx4_zone_allocator *zone_alloc) > > @@ -468,7 +466,8 @@ int mlx4_zone_remove_one(struct mlx4_zone_allocator *zones, u32 uid) > > goto out; > > } > > > > - res = __mlx4_zone_remove_one_entry(zone); > > + __mlx4_zone_remove_one_entry(zone); > > + res = 0; > > Will look better if initialization will move to variable declaration. > Yes, please. Thanks
diff --git a/drivers/net/ethernet/mellanox/mlx4/alloc.c b/drivers/net/ethernet/mellanox/mlx4/alloc.c index 249a458..bfb185d 100644 --- a/drivers/net/ethernet/mellanox/mlx4/alloc.c +++ b/drivers/net/ethernet/mellanox/mlx4/alloc.c @@ -283,7 +283,7 @@ int mlx4_zone_add_one(struct mlx4_zone_allocator *zone_alloc, } /* Should be called under a lock */ -static int __mlx4_zone_remove_one_entry(struct mlx4_zone_entry *entry) +static void __mlx4_zone_remove_one_entry(struct mlx4_zone_entry *entry) { struct mlx4_zone_allocator *zone_alloc = entry->allocator; @@ -315,8 +315,6 @@ static int __mlx4_zone_remove_one_entry(struct mlx4_zone_entry *entry) } zone_alloc->mask = mask; } - - return 0; } void mlx4_zone_allocator_destroy(struct mlx4_zone_allocator *zone_alloc) @@ -468,7 +466,8 @@ int mlx4_zone_remove_one(struct mlx4_zone_allocator *zones, u32 uid) goto out; } - res = __mlx4_zone_remove_one_entry(zone); + __mlx4_zone_remove_one_entry(zone); + res = 0; out: spin_unlock(&zones->lock);
The function __mlx4_zone_remove_one_entry always returns zero. So it is not necessary to check it. Cc: Joe Jin <joe.jin@oracle.com> Cc: Junxiao Bi <junxiao.bi@oracle.com> Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com> --- drivers/net/ethernet/mellanox/mlx4/alloc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)