From patchwork Sat Nov 26 11:16:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhen Lei X-Patchwork-Id: 26211 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp4577702wrr; Sat, 26 Nov 2022 03:19:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf5e5sxqd0XgMhVEuKdfXq094mXctw/UpY2NUP9NwrD1YYM2eWZ0ob0K6OfXlEw9pbCmXqqY X-Received: by 2002:a17:903:240a:b0:188:5d24:87e with SMTP id e10-20020a170903240a00b001885d24087emr22889907plo.87.1669461557550; Sat, 26 Nov 2022 03:19:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669461557; cv=none; d=google.com; s=arc-20160816; b=0o+evSmS0LHlq6CV+oFRM23iPuKmgKCZ9b1Z1hFNTWn9ULEKoLRQupGri32yJYevak mJafd/kR29NVTg7OrwwA3oMtJGtnHz96L4MmDrT9u0kXns45ECeSYDQtG4gmayytNGua sCs0+ga0CzKDB41GnrhOIxkt9FwZiy6SvcTEULBrMl0wJdAEKbB1fMd25nPZEPQbAksy N6iZKl+eoQ2br+o0HTQL+QOr41f/k6sFvlvTO8KGqt+DYXnAbaKKqrQX8RFodCqsTf7+ QsPp23pYmW/t/fKnURPs7ePAQZZ5TahG0+hbpuWKACuDGUjzEIwf6VQYhVjo0S9rWE5I /gXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Az72lD4DJWQj+Tgk/KKDiz29iCPCy8ILNt3jKTIyPW8=; b=TMCOZGn8tZ/GG9hI1yGm7FBvh6hbh3P9bZHPYtjW66ahueyfUGFjti4oxaTLMKRepq HkyuCKmbNtOND3XXcXnbmGtWc0XCVAB2vPHv0TPzMbs/HfWngzoveQhq7k3q9ULY/ElH 09ux5UTuDsW0ZBF7CSUswQ/k9mgouFfR3WFYtkIUXR7H0v7neK1FfBTAp3mmk71kl/Hx XDlTgDAICLXGwYarWAIKoQyipSL9k3Dx1jj/ctBi/kYP0gKGuI3kMp4a62oPePDGBeZg ZcmD34jrMOFQzrniMttUnrVcjit8xJGQRgq9+RBYQ5kN4CUxR9Z3zjyIxcw3oPpZJYZx jlQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bm18-20020a656e92000000b00477444fe34asi6666394pgb.770.2022.11.26.03.19.04; Sat, 26 Nov 2022 03:19:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229599AbiKZLSE (ORCPT + 99 others); Sat, 26 Nov 2022 06:18:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229582AbiKZLRp (ORCPT ); Sat, 26 Nov 2022 06:17:45 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 298B3B4BB for ; Sat, 26 Nov 2022 03:17:42 -0800 (PST) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NK8MN6Qy7zmW99; Sat, 26 Nov 2022 19:17:04 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 26 Nov 2022 19:17:40 +0800 Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 26 Nov 2022 19:17:39 +0800 From: Zhen Lei To: Greg Kroah-Hartman , Tejun Heo , CC: Zhen Lei Subject: [PATCH v2] kernfs: remove an unused if statement in kernfs_path_from_node_locked() Date: Sat, 26 Nov 2022 19:16:34 +0800 Message-ID: <20221126111634.1994-1-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.37.3.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750557322322408095?= X-GMAIL-MSGID: =?utf-8?q?1750557322322408095?= It makes no sense to call kernfs_path_from_node_locked() with NULL buf, and no one is doing that right now. Suggested-by: Tejun Heo Signed-off-by: Zhen Lei Acked-by: Tejun Heo --- fs/kernfs/dir.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index f33b3baad07cb36..8a11bf189970274 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -149,9 +149,6 @@ static int kernfs_path_from_node_locked(struct kernfs_node *kn_to, if (kn_from == kn_to) return strlcpy(buf, "/", buflen); - if (!buf) - return -EINVAL; - common = kernfs_common_ancestor(kn_from, kn_to); if (WARN_ON(!common)) return -EINVAL;