Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4266664rwb; Sun, 7 Aug 2022 19:49:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR6pOrnGSC+g7YUyc7Lwg4PfyU1YM2ibmKvODifUi1PYVmA7J0kiQYDioxlcu5ESn4aF9lDB X-Received: by 2002:a17:902:f688:b0:16f:28:ea27 with SMTP id l8-20020a170902f68800b0016f0028ea27mr16394788plg.151.1659926998637; Sun, 07 Aug 2022 19:49:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659926998; cv=none; d=google.com; s=arc-20160816; b=gGLYfKih3fH1V3azJMBV/6lXfofsLZpdWNivmzzTO4lhHV/RG86Ew8CppDOqaBKiHn DXjZe1tNCRcDOGdYt+8uqWDy4a0C1B2PPX9/hDSKWbFa3b5mbpUJsxo1P1CUC1EITwyg dKHJ5uNJGXcQycy96taLFq8ydFEGwOGfWu0rHG7EO8/WTQ4IPG6/PZpQfyyef2js/7mx 10+AMM3yF5/zeSDWqAMcM3VxvaKx9ppykvTpEXgplTmojh5SRwg+C3VxsSxpCHvg8ZJO P2hkxaY4OebqTOogEdm+yYdgViyPgz5EY8cjouC4WAda9ppT1L0V+jaYiNXjzuHmGnKU Mz7A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wLb5hbLfrLVQJ7EKEXDx8+mIiyapZCGY09Uya8XdbEg=; b=xGZS1Mg8jEDvf12oo3uTiD70zZ2D6IUL2kxjNZC6xxbwhHioV7Fd0JJ3XC9bS/xRJO WreuW6IiM982l4QeJPyQHhsJi600/ZbpyTa1PdWL/adPc3GYRjY4s4+jPM9AkJ+BDuKe OOU9Okz7IlzKesmt8DKQntNvgs48AKr6ytmwxOa9Ug07At9JfgukDZ9OuLa6nRwGcRnD FVOYarCxMeYN7Xpy/vHpIquG58jq2aTrZHzLsRIwbTbv7GP2KSndifXJjnNd7GNh5gmY 77olkqn266fUyXG8aHedZi7fMU4ULpJyefFyqtqy08otsZTf8mgWaWLcBn7hvfTcxiWl HUCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aAZbeVCJ; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d6-20020a170902728600b0016f051a2578si10174611pll.476.2022.08.07.19.49.44; Sun, 07 Aug 2022 19:49:58 -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=@kernel.org header.s=k20201202 header.b=aAZbeVCJ; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242504AbiHHBhT (ORCPT + 99 others); Sun, 7 Aug 2022 21:37:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242209AbiHHBfw (ORCPT ); Sun, 7 Aug 2022 21:35:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5F68CE0B; Sun, 7 Aug 2022 18:33:21 -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 7C34A60CF7; Mon, 8 Aug 2022 01:33:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1A89C433D6; Mon, 8 Aug 2022 01:33:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659922400; bh=698Flm7SpQJiRiiikVpbc456D/RJv3Ovb7vU4f/tM+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aAZbeVCJhIXHDEJAXrU1VxCJ66tx+j5967/bPwCfHiNslvqoliax8pihVDTYz9AMP Sh1EmMy+8pDa88kI04ftAV1aGur04/9PESDrbp1PjCuGbutfk8yfcv8O+LFx86gZSI rKd1AIR0VQOLZiKvUpXchmt9lMUwMpawGXoYXpN82z/CfRfNyEKH56HNgl3N8iSL21 lqu6WjzMbqiZDqRIeuL3YJ73juWup2tmxSPtrJwjjLJ9wWBvY80wvD6WbhL4cB/5QZ jaGWUCyA8vNc4yHXxEC/hRjd09wsTyAviTiYWMfGrWYpDbjdlh+hvI/OdQEhijsWyA nJ7PspPJKW6tw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Lv Ruyi , Zeal Robot , Thierry Reding , Sasha Levin , thierry.reding@gmail.com, jonathanh@nvidia.com, arnd@arndb.de, linux-tegra@vger.kernel.org Subject: [PATCH AUTOSEL 5.19 47/58] firmware: tegra: Fix error check return value of debugfs_create_file() Date: Sun, 7 Aug 2022 21:31:05 -0400 Message-Id: <20220808013118.313965-47-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220808013118.313965-1-sashal@kernel.org> References: <20220808013118.313965-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 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