Linux Tegra architecture development
 help / color / mirror / Atom feed
From: "Jinhui Guo" <guojinhui.liam@bytedance.com>
To: "Thierry Reding" <thierry.reding@kernel.org>,
	 "Jonathan Hunter" <jonathanh@nvidia.com>,
	<linux-tegra@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
	"Kartik Rajput" <kkartik@nvidia.com>,
	 "Jinhui Guo" <guojinhui.liam@bytedance.com>
Subject: [PATCH 1/2] soc/tegra: fuse: Return -ENODEV for unsupported legacy SoCs
Date: Tue,  4 Aug 2026 20:19:09 +0800	[thread overview]
Message-ID: <20260804121910.4961-2-guojinhui.liam@bytedance.com> (raw)
In-Reply-To: <20260804121910.4961-1-guojinhui.liam@bytedance.com>

When booting without a FUSE device tree node, tegra_init_fuse() falls
back to legacy SoC detection on 32-bit ARM systems. If the detected chip
ID does not match any supported SoC, the default case only prints a
warning and breaks out of the switch statement.

In that case fuse->soc remains NULL, but initialization continues and
later calls fuse->soc->init(fuse), which results in a NULL pointer
dereference.

Return -ENODEV from the default case to stop initialization immediately
when the legacy fallback detects an unsupported SoC.

Fixes: 7e939de1b2bb ("soc/tegra: fuse: Unify Tegra20 and Tegra30 drivers")
Signed-off-by: Jinhui Guo <guojinhui.liam@bytedance.com>
---
 drivers/soc/tegra/fuse/fuse-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index 78b054d43a42..e539e6b595b0 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -520,7 +520,7 @@ static int __init tegra_init_fuse(void)
 
 			default:
 				pr_warn("Unsupported SoC: %02x\n", chip);
-				break;
+				return -ENODEV;
 			}
 		} else {
 			/*
-- 
2.20.1

  reply	other threads:[~2026-08-04 12:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04 12:19 [PATCH 0/2] soc/tegra: fuse: Fix unsupported SoC init path and log formatting Jinhui Guo
2026-08-04 12:19 ` Jinhui Guo [this message]
2026-08-05  7:40   ` [PATCH 1/2] soc/tegra: fuse: Return -ENODEV for unsupported legacy SoCs Thierry Reding
2026-08-04 12:19 ` [PATCH 2/2] soc/tegra: fuse: Add missing newline to APBMISC error message Jinhui Guo
2026-08-05  7:47 ` (subset) [PATCH 0/2] soc/tegra: fuse: Fix unsupported SoC init path and log formatting Thierry Reding

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260804121910.4961-2-guojinhui.liam@bytedance.com \
    --to=guojinhui.liam@bytedance.com \
    --cc=jonathanh@nvidia.com \
    --cc=kkartik@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox