lkml.org 
[lkml]   [2018]   [Sep]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] lib/sg_pool: remove unnecessary null check when free the object
Hi,  Thomas

Can you pick up the patch?

Thanks
zhong jiang
On 2018/8/1 0:21, zhong jiang wrote:
> kmem_cache_destroy/mempool_destroy has taken null check into account.
> so remove the redundant check.
>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
> lib/sg_pool.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/lib/sg_pool.c b/lib/sg_pool.c
> index 6dd3061..d1c1e63 100644
> --- a/lib/sg_pool.c
> +++ b/lib/sg_pool.c
> @@ -148,10 +148,9 @@ static __init int sg_pool_init(void)
> cleanup_sdb:
> for (i = 0; i < SG_MEMPOOL_NR; i++) {
> struct sg_pool *sgp = sg_pools + i;
> - if (sgp->pool)
> - mempool_destroy(sgp->pool);
> - if (sgp->slab)
> - kmem_cache_destroy(sgp->slab);
> +
> + mempool_destroy(sgp->pool);
> + kmem_cache_destroy(sgp->slab);
> }
>
> return -ENOMEM;


\
 
 \ /
  Last update: 2018-09-08 11:40    [W:0.057 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site