Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4336762rwd; Tue, 30 May 2023 04:08:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4uYNE7haV6UgxcPmyVEyWdZ1hV5BQFXtFwyxVtigrRo9hCS3bVfVOfxLIvrjvg2mF9b4zj X-Received: by 2002:a17:90a:c58a:b0:253:2f58:fe62 with SMTP id l10-20020a17090ac58a00b002532f58fe62mr2268723pjt.19.1685444897444; Tue, 30 May 2023 04:08:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685444897; cv=none; d=google.com; s=arc-20160816; b=ATORhCGXvta1nBgdRxoFl8wA2bMlknCByqThYZOAmdxrIfuQd8J3Gay3dvAlZGv4jg r/DzDRjg4Hb2RyWjgfqInZnTEhslL5RcWdI236CrFxA8ZbSRBcxgfE35PAGLlfxUSUB4 4/AEiIcCiwLBzBKySDIKs2FPR9dZTN1Jnkm5Z5cjq9M5buJi2uUWNU8rAtC+7Z3Xj7EG 5SBUUPk5cNR3X69abQ3WFwUUl91ZzO1VWzNtvnrz0mdl9tzj43hrxkmJ1LJdf+Zz11ep HWcitmBo+JoweQ6NJJYhCTpA8CJDK5YcWWmOfxH7UUu4zwIpIfrlpxBoPe7BM3M6deVa DzmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=G20+Sdm/98wI46f2WRdfsERiE5mRdZTpwi6+jvG8R1U=; b=Kn4vXIWAXqTcODnqNhup3MUL/LPktFRbbgwFokpEha3aYULDs2GW/1AKWtJEOdAL39 dDVUTePDUxfQy71zL7LHd9HOD1Y5e1zuA/rjmeY8WhOy4ThEW5oXG3ORQMYWDoWOfT/I B6TIuaK/mWORH4BJRTR8TfWPVfHVA/Ye8gPV7C9HqRHnNR7LhXgYJdjMAcL75sDlnH6i PBoHryQAkkRkzjIMAS8LpOzXxvYAHV/pXSzGO9WSLfebA9hpt3lPhMqCXRLt8w1ESH0y 9ajhQusWVjGNPvRnU5pytf0i281sAS8gGZcKH3C3c13GgLW2uuIaN6yrofwsrUscHFLJ li2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=d+o7t46B; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id my12-20020a17090b4c8c00b002500dd30da9si10933843pjb.6.2023.05.30.04.08.02; Tue, 30 May 2023 04:08:17 -0700 (PDT) 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; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=d+o7t46B; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230164AbjE3KsP (ORCPT + 99 others); Tue, 30 May 2023 06:48:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231730AbjE3Krn (ORCPT ); Tue, 30 May 2023 06:47:43 -0400 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD45FE8 for ; Tue, 30 May 2023 03:47:29 -0700 (PDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4QVpxl6C6cz4x1R; Tue, 30 May 2023 20:47:23 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1685443644; bh=G20+Sdm/98wI46f2WRdfsERiE5mRdZTpwi6+jvG8R1U=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=d+o7t46BGfbpB2ob36lRdXwMjgQzcU5NBOtF/Kj7UJztuuPyk2IJwa73ehmTZJQZo lvophwgIwGtC8ggYJcCw84/aiAJxtLUARSGeIkR/a/WeQWaJf4d5aL3btthULw/ymK dUN3IYKTAdv1A9ZqJmKYbWoAUGf68BGtcBZmWCXtuZkI3i1CwSoWzqGU66PE9lgAtg o0TyPjR/HLQXmG6vR4z6WibmSmBFnhzNC+sbSnk3pP8LwhuOSdCI4I/trcM/k8aBRr dkab/MWQeszlLgVUVkCgRfpuf4j5ULMqcer+eONXtqEJqnh3qwntA9qAq2Tv7NJxnX sKg7GkCAT7jfQ== From: Michael Ellerman To: Greg KH , mirimmad@outlook.com Cc: Immad Mir , Ivan Orlov , Nicholas Piggin , Christophe Leroy , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] powerpc: fix debugfs_create_dir error checking In-Reply-To: <2023052835-oxidant-doily-404f@gregkh> References: <2023052835-oxidant-doily-404f@gregkh> Date: Tue, 30 May 2023 20:47:21 +1000 Message-ID: <87zg5mrt8m.fsf@mail.lhotse> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Greg KH writes: > On Sun, May 28, 2023 at 01:16:44PM +0530, mirimmad@outlook.com wrote: >> From: Immad Mir >> >> The debugfs_create_dir returns ERR_PTR incase of an error and the >> correct way of checking it by using the IS_ERR inline function, and >> not the simple null comparision. This patch fixes this. >> >> Suggested-By: Ivan Orlov >> Signed-off-by: Immad Mir >> --- >> arch/powerpc/platforms/powernv/opal-xscom.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/arch/powerpc/platforms/powernv/opal-xscom.c b/arch/powerpc/platforms/powernv/opal-xscom.c >> index 6b4eed2ef..262cd6fac 100644 >> --- a/arch/powerpc/platforms/powernv/opal-xscom.c >> +++ b/arch/powerpc/platforms/powernv/opal-xscom.c >> @@ -168,7 +168,7 @@ static int scom_debug_init_one(struct dentry *root, struct device_node *dn, >> ent->path.size = strlen((char *)ent->path.data); >> >> dir = debugfs_create_dir(ent->name, root); >> - if (!dir) { >> + if (IS_ERR(dir)) { >> kfree(ent->path.data); >> kfree(ent); >> return -1; > > Why is this driver caring if debugfs is working or not at all? It > should just ignore the error and keep moving forward. It's creating directories and then creating files in those directories. So I think it makes sense that it checks that the directory was created successfully. It doesn't check whether the files were created. > And -1 is not a valid error number :( It's EPERM :) - but yeah probably not really the right error in this case. Still I think this patch is an improvement so I'll plan to merge it. cheers