From: XU pengfei <xupengfei@nfschina.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
XU pengfei <xupengfei@nfschina.com>
Subject: [PATCH V2] mm/mmap_lock: Remove unnecessary 'NULL' values from Pointer
Date: Mon, 10 Oct 2022 11:42:38 +0800 [thread overview]
Message-ID: <20221010034238.3604-1-xupengfei@nfschina.com> (raw)
Pointer variables allocate memory first, and then judge. There is no
need to initialize the assignment.
Signed-off-by: XU pengfei <xupengfei@nfschina.com>
Reported-by: kernel test robot <lkp@intel.com>
---
V2: Remove goto statement
mm/mmap_lock.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/mm/mmap_lock.c b/mm/mmap_lock.c
index 1854850b4b89..d0c2a5eae341 100644
--- a/mm/mmap_lock.c
+++ b/mm/mmap_lock.c
@@ -198,23 +198,24 @@ void trace_mmap_lock_unreg(void)
*/
static const char *get_mm_memcg_path(struct mm_struct *mm)
{
- char *buf = NULL;
+ char *buf;
struct mem_cgroup *memcg = get_mem_cgroup_from_mm(mm);
if (memcg == NULL)
- goto out;
- if (unlikely(memcg->css.cgroup == NULL))
- goto out_put;
+ return NULL;
+ if (unlikely(memcg->css.cgroup == NULL)) {
+ css_put(&memcg->css);
+ return NULL;
+ }
buf = get_memcg_path_buf();
- if (buf == NULL)
- goto out_put;
+ if (buf == NULL) {
+ css_put(&memcg->css);
+ return NULL;
+ }
cgroup_path(memcg->css.cgroup, buf, MEMCG_PATH_BUF_SIZE);
-out_put:
- css_put(&memcg->css);
-out:
return buf;
}
--
2.18.2
next reply other threads:[~2022-10-10 3:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 3:42 XU pengfei [this message]
2022-10-10 3:46 ` Matthew Wilcox
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=20221010034238.3604-1-xupengfei@nfschina.com \
--to=xupengfei@nfschina.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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