From nobody Tue Apr 7 01:55:56 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EA49C433FE for ; Mon, 10 Oct 2022 03:42:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230254AbiJJDmv (ORCPT ); Sun, 9 Oct 2022 23:42:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230097AbiJJDms (ORCPT ); Sun, 9 Oct 2022 23:42:48 -0400 Received: from mail.nfschina.com (mail.nfschina.com [124.16.136.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7A12327CD4 for ; Sun, 9 Oct 2022 20:42:47 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id 965ED1E80D90; Mon, 10 Oct 2022 11:36:43 +0800 (CST) X-Virus-Scanned: amavisd-new at test.com Received: from mail.nfschina.com ([127.0.0.1]) by localhost (mail.nfschina.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dBUciL1iuwIY; Mon, 10 Oct 2022 11:36:41 +0800 (CST) Received: from localhost.localdomain.localdomain (unknown [219.141.250.2]) (Authenticated sender: xupengfei@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id 5FD971E80D4B; Mon, 10 Oct 2022 11:36:39 +0800 (CST) From: XU pengfei To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, XU pengfei Subject: [PATCH V2] mm/mmap_lock: Remove unnecessary 'NULL' values from Pointer Date: Mon, 10 Oct 2022 11:42:38 +0800 Message-Id: <20221010034238.3604-1-xupengfei@nfschina.com> X-Mailer: git-send-email 2.18.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Pointer variables allocate memory first, and then judge. There is no need to initialize the assignment. Signed-off-by: XU pengfei Reported-by: kernel test robot --- 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 =3D NULL; + char *buf; struct mem_cgroup *memcg =3D get_mem_cgroup_from_mm(mm); =20 if (memcg =3D=3D NULL) - goto out; - if (unlikely(memcg->css.cgroup =3D=3D NULL)) - goto out_put; + return NULL; + if (unlikely(memcg->css.cgroup =3D=3D NULL)) { + css_put(&memcg->css); + return NULL; + } =20 buf =3D get_memcg_path_buf(); - if (buf =3D=3D NULL) - goto out_put; + if (buf =3D=3D NULL) { + css_put(&memcg->css); + return NULL; + } =20 cgroup_path(memcg->css.cgroup, buf, MEMCG_PATH_BUF_SIZE); =20 -out_put: - css_put(&memcg->css); -out: return buf; } =20 --=20 2.18.2