Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1856373rwb; Fri, 19 Aug 2022 10:31:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR7lC4eBEWvES7vvSo8TjI8GNc6NzGAPYOzXqugJt0SKqVT3TP6IxKmaeVNZeQByKniaSzuJ X-Received: by 2002:a63:8549:0:b0:42a:2ae0:98ce with SMTP id u70-20020a638549000000b0042a2ae098cemr5211493pgd.72.1660930265958; Fri, 19 Aug 2022 10:31:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930265; cv=none; d=google.com; s=arc-20160816; b=CeuOR+Zs0crZyySBoH9MskfJA8VYsvBz/ZDKqjwjlGKnHjhIRqpV5gP3X4fzTxgrSy cheRkzCpr1rBh6wQkHqP4ev56LrtuNIyunYpyRp/0D6JZL45j2uJjkk8xR126iBAd7zK +Nmx0fezb/mV99rENZGc1YdGSeSRsAtzWM6wCnpXiauSNcSaBGoXAg+hQ01McinGLLO8 av/FzM59P+wLvLlAxLRELUf6TcKECozTY9dJyd+XhK++u/mF8wTvth15YCcNCBc24D+7 OIoMuPtwmLxDeZMUmW9qLjfDCycxdmJ0H+vrx5GnP9siQ7wS25AIsrrcqEd/nY3XQf3M uysg== 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=9s6qbJzXFniAcNNEFFR3CykhpG2uLIzERwvnpO/hcXU=; b=tOqU2I2oQelYj5aFHnLeXmNhxGGmgpXClYrEpJPP8Bwf52DR0U+3UKA4dB3yOeAJ89 PTP0ZiWvlNsepAxZxDmoFPyJVMBjixxKmPGpWaCBqI4NyGWr+jw3sOBRNuTRZMxS8Diu CwxBBBzvOU4a7l/BMe9dzTUbb4Ib+JSPXIHmK3fKuvWyyXbKM/KsUuqk01BtyzfHvV0d +XMtMM4aUMCydBjSBI9JQlWKsBYOxTo8rCTTjjPSaNlHulwVKlrPjHdpX+EQZJY6FC6s PISsBFoPS2hhYCGwS9WNvAXVuAgEPBtdBkoH90Uhf24d3fKw1PQi+HqS+vqMDDk+ApGI Z2Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2TArbcc9; 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 my10-20020a17090b4c8a00b001f768edcce3si8322775pjb.72.2022.08.19.10.30.55; Fri, 19 Aug 2022 10:31:05 -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=2TArbcc9; 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 S1350837AbiHSP6P (ORCPT + 99 others); Fri, 19 Aug 2022 11:58:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350926AbiHSP4D (ORCPT ); Fri, 19 Aug 2022 11:56:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9D5E10521D; Fri, 19 Aug 2022 08:50:46 -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 dfw.source.kernel.org (Postfix) with ESMTPS id A3B0A616F9; Fri, 19 Aug 2022 15:50:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B31DFC433D6; Fri, 19 Aug 2022 15:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924237; bh=gVNJEFm1Q3F65zmNeU+fdgNngxG14eW9scGa3m0pN5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2TArbcc9Hp94AC+5hfd3hCTkB3wr9VZZCeQkbCmR3EmQBy7qnwqfmBj4RgDguwAPe 0Xuc5/QKJWmBLL78ogWoiAkp7dYvpYFt6QDvp0Sr2vGjPlGwp4brj2ZD7XCpfnxx/n Whfv8YJqYjwx5i4iBeF2O3oXnBRyqkvXXaUpYPiU= 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.10 102/545] firmware: tegra: Fix error check return value of debugfs_create_file() Date: Fri, 19 Aug 2022 17:37:52 +0200 Message-Id: <20220819153833.841992911@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@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 440d99c63638..fad97ec8e81f 100644 --- a/drivers/firmware/tegra/bpmp-debugfs.c +++ b/drivers/firmware/tegra/bpmp-debugfs.c @@ -429,7 +429,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; } @@ -680,7 +680,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) @@ -693,7 +693,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; } } @@ -743,11 +743,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