Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3015170rwb; Mon, 15 Aug 2022 16:11:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR6cdv+mg2Z2BLCwnszV7Z+Cqs6+wfVlSNoxCaiIdwGvpmSTOMFTfsIk6N/w22WASj0AgnxQ X-Received: by 2002:aa7:dd42:0:b0:440:916e:9a38 with SMTP id o2-20020aa7dd42000000b00440916e9a38mr16503509edw.302.1660605077785; Mon, 15 Aug 2022 16:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605077; cv=none; d=google.com; s=arc-20160816; b=i880Zpgrl2etI0T+PjJ8NY7iR9Bbpw/qbPV87H6Avc6Bi/QXcqQCyctcpVE2t7gDO3 LPU8Kn7Ata1CWQBVATSyHtgYHT5aAcF0ICrGx5ireShhS75J/8GOTMQ9dphUk2VCBYZE IMq1FB+4DxxdLgiXiG5cytUR3tJUcNEepO1/Lxmn9qiAvp/PRcTcOh0H1SkbiahRk6uV 15w5NN7C19t5bPnCkajagb23JahoWOf32YbfH2HH36nmJO6iMdeP6N9mCSUmT7peIksE kK/1y555Kyx4X8VrisLwkvzJwdrhV34kFVDYsZrvFqbjV6sO12saGW28DGBtBmLSiA48 LIOg== 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=sL8Ql3JEDVQ1yIEviCeceS6wLZGSJ12mwfxM20Br528DxdzRV/QLySIoV7QZLiW1Gr wIQObvZ5r9M7WWw6rKSxl0FsIr+fnZKgpR70UH1OHyFv0tM/VRq8OUlVVt0BcCv9qn9F D52n4CN0QwBvWvRJbe31j+vcL4drFe6zbni9tHdZjw+h0uyO314SrA9vGWAJ+riOv7SG GdIJIoHhdXMdRfQsLmgh23vNwVkBIJc0pPONxHx8bqoaJ6P+HieCoKIDXLcd+jo0Ky6l oSKBVhoRy+zImpBke7Q2CRqtdW9x15qYI+VAPHGkGO3LjB2/UrZPzAz746KPGkGJZ+A+ K87A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qKQfigKl; 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 x1-20020a1709064a8100b0072b3305dbbesi7340215eju.520.2022.08.15.16.10.52; Mon, 15 Aug 2022 16:11: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=@linuxfoundation.org header.s=korg header.b=qKQfigKl; 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 S1349936AbiHOWij (ORCPT + 99 others); Mon, 15 Aug 2022 18:38:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350844AbiHOWcQ (ORCPT ); Mon, 15 Aug 2022 18:32:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA77912E244; Mon, 15 Aug 2022 12:49:05 -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 ams.source.kernel.org (Postfix) with ESMTPS id 65901B80EB2; Mon, 15 Aug 2022 19:48:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9EBBC433C1; Mon, 15 Aug 2022 19:48:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592921; bh=698Flm7SpQJiRiiikVpbc456D/RJv3Ovb7vU4f/tM+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qKQfigKloQrcMwo9Pj8BdYJfzr04IuSFtKYpunkX3AV/BZ0Os/EbJlGJGlyvhNm4i emmBxS88G1BCejT861jq0pjjHkIUMkoFXR7+etLzfkEeKw4A0hw/3wrVJGOsQEGy1e rkDqNlf804Odfe6Y20+zI8mDf/yJIxsAT4UZg6PI= 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.19 0187/1157] firmware: tegra: Fix error check return value of debugfs_create_file() Date: Mon, 15 Aug 2022 19:52:23 +0200 Message-Id: <20220815180447.239973487@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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