From: zhong jiang <zhongjiang@huawei.com>
To: <tglx@linutronix.de>, <longman@redhat.com>
Cc: <arnd@arndb.de>, <yang.shi@linux.alibaba.com>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] lib/sg_pool: remove unnecessary null check when free the object
Date: Wed, 1 Aug 2018 00:21:47 +0800 [thread overview]
Message-ID: <1533054107-35657-1-git-send-email-zhongjiang@huawei.com> (raw)
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;
--
1.7.12.4
next reply other threads:[~2018-07-31 16:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-31 16:21 zhong jiang [this message]
2018-09-08 9:39 ` zhong jiang
2018-09-08 9:46 ` Thomas Gleixner
2018-09-08 10:05 ` zhong jiang
2018-09-08 10:21 ` Thomas Gleixner
2018-09-08 10:33 ` zhong jiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1533054107-35657-1-git-send-email-zhongjiang@huawei.com \
--to=zhongjiang@huawei.com \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=tglx@linutronix.de \
--cc=yang.shi@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®