linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
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 1/1] mm/mmap_lock: Remove unnecessary 'NULL' values from Pointer
Date: Sun,  9 Oct 2022 11:41:54 +0800	[thread overview]
Message-ID: <20221009034153.4418-1-xupengfei@nfschina.com> (raw)

Remove unnecessary 'NULL' values from Pointer and goto statement

Signed-off-by: XU pengfei <xupengfei@nfschina.com>
---
 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



             reply	other threads:[~2022-10-09  3:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-09  3:41 XU pengfei [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-10-08  9:39 XU pengfei
2022-10-08 12:21 ` Miaohe Lin
2022-10-08 13:14 ` kernel test robot

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=20221009034153.4418-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