Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2925195rwb; Mon, 15 Aug 2022 14:10:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR43BjAuOE5fPsX2FZ8+sqWxxd+IEJdMn2tzwmeB3fYUgqOIGnx2CuRG4GiiLOA7gGTVFUwa X-Received: by 2002:a05:6402:e01:b0:442:dd7e:f49d with SMTP id h1-20020a0564020e0100b00442dd7ef49dmr15827864edh.355.1660597810907; Mon, 15 Aug 2022 14:10:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597810; cv=none; d=google.com; s=arc-20160816; b=IAKvH36Z4et1WJ8RbPq1ManCjEfiNXDMSfoj7q2JAVr6O/AbOYmbn0DzRbY8zoT1qj JMRCKTNx0P3jKH0c30PPg7yxw4LyGsdPdOttrEaf/q+3CI7nOZbuWqZ2O3X+8+kG4s3R NTU7qj/6xffs2hkvU75JR38vJ/6o+2JfgDSYuGDoCDKcOZ3p/lHOsGiPww793S6ldhLl GuYtiKYt+db3ezxxYBvPW1ajScMz2nsmOVEN19qdSH0CoIUs4KI08Ta9/k5t0Wxd5UJB cU68dhmbWZAttcafvojfzHOUWkYlYqFy07Qp23+uXNR8bsSOjgn647WHXc2B2SLzL/wx B7cA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wLb5hbLfrLVQJ7EKEXDx8+mIiyapZCGY09Uya8XdbEg=; b=a+bzGezVz7jZ1DOAxuQ+qoNzyuyM3bjyyna6vquEc7/xTZS3aApBvYbp2kBSC1QX+R l8jreC+ZqrjX0ptPLh21kOtcmE4p15MCdUu5m5XHxMAx/nlMC+DoFFxS4FadKZRXWYvd LFQXQWuZUgpmZOh8XhRMOaS9Cr0dhZSHz4VabE9UdcPJOm4vJ9LLcFstSdXdznXtLv9E 2whN/BvTb5/Cp99Uy/KpWL0kTcdPehzYQpJRIKGs9J04BFF5yUQrfT7OL2Phx6H2/u// oQVGloxibgMhpNtrfVwcpY55CPPf+mRBz/6NeYY/Yb+MkKbe/H0LTJqW6jBU5CNG0IXR QvtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fnYB8+38; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr14-20020a170907720e00b0073765643617si6788867ejc.233.2022.08.15.14.09.45; Mon, 15 Aug 2022 14:10:10 -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=@linuxfoundation.org header.s=korg header.b=fnYB8+38; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347459AbiHOUbL (ORCPT + 99 others); Mon, 15 Aug 2022 16:31:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244614AbiHOUWc (ORCPT ); Mon, 15 Aug 2022 16:22:32 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A812033E34; Mon, 15 Aug 2022 12:02:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 83612CE129B; Mon, 15 Aug 2022 19:02:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BE10C43142; Mon, 15 Aug 2022 19:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590164; bh=698Flm7SpQJiRiiikVpbc456D/RJv3Ovb7vU4f/tM+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fnYB8+38G4WwMHUZpims+Asa6uQKyfNvT+zTSWoCY7N0L7Lspp64pxWBLAR0tfsxC cAy7MurHrTv20t6YyTVZY0bq0/EQxSDaeyCa1NNMj+GXi3LeP/vWjARsZApQcMuOF7 /IaNaHnvXy8ABBl9Cx6cEh8XTh2DtbK2srv+soRU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , Lv Ruyi , Thierry Reding , Sasha Levin Subject: [PATCH 5.18 0173/1095] firmware: tegra: Fix error check return value of debugfs_create_file() Date: Mon, 15 Aug 2022 19:52:52 +0200 Message-Id: <20220815180436.793193204@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Lv Ruyi [ Upstream commit afcdb8e55c91c6ff0700ab272fd0f74e899ab884 ] If an error occurs, debugfs_create_file() will return ERR_PTR(-ERROR), so use IS_ERR() to check it. Reported-by: Zeal Robot Signed-off-by: Lv Ruyi Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin --- drivers/firmware/tegra/bpmp-debugfs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/firmware/tegra/bpmp-debugfs.c b/drivers/firmware/tegra/bpmp-debugfs.c index fd89899aeeed..0c440afd5224 100644 --- a/drivers/firmware/tegra/bpmp-debugfs.c +++ b/drivers/firmware/tegra/bpmp-debugfs.c @@ -474,7 +474,7 @@ static int bpmp_populate_debugfs_inband(struct tegra_bpmp *bpmp, mode |= attrs & DEBUGFS_S_IWUSR ? 0200 : 0; dentry = debugfs_create_file(name, mode, parent, bpmp, &bpmp_debug_fops); - if (!dentry) { + if (IS_ERR(dentry)) { err = -ENOMEM; goto out; } @@ -725,7 +725,7 @@ static int bpmp_populate_dir(struct tegra_bpmp *bpmp, struct seqbuf *seqbuf, if (t & DEBUGFS_S_ISDIR) { dentry = debugfs_create_dir(name, parent); - if (!dentry) + if (IS_ERR(dentry)) return -ENOMEM; err = bpmp_populate_dir(bpmp, seqbuf, dentry, depth+1); if (err < 0) @@ -738,7 +738,7 @@ static int bpmp_populate_dir(struct tegra_bpmp *bpmp, struct seqbuf *seqbuf, dentry = debugfs_create_file(name, mode, parent, bpmp, &debugfs_fops); - if (!dentry) + if (IS_ERR(dentry)) return -ENOMEM; } } @@ -788,11 +788,11 @@ int tegra_bpmp_init_debugfs(struct tegra_bpmp *bpmp) return 0; root = debugfs_create_dir("bpmp", NULL); - if (!root) + if (IS_ERR(root)) return -ENOMEM; bpmp->debugfs_mirror = debugfs_create_dir("debug", root); - if (!bpmp->debugfs_mirror) { + if (IS_ERR(bpmp->debugfs_mirror)) { err = -ENOMEM; goto out; } -- 2.35.1