[PATCH 1/2] soc/tegra: fuse: Return -ENODEV for unsupported legacy SoCs

"Jinhui Guo" <[email protected]>
Newsgroups gmane.linux.ports.tegra,gmane.linux.kernel
Message-ID <[email protected]>
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 <[email protected]>
---
 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.