Browse Source

soc/tegra: fuse: Warn if accessing unmapped registers

If the FUSE registers are accessed but the region is not mapped, warn
and return 0. This potentially catches hard to diagnose bugs because the
accesses happen before any kernel log output.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Thierry Reding 8 years ago
parent
commit
da943840bc
1 changed files with 3 additions and 0 deletions
  1. 3 0
      drivers/soc/tegra/fuse/fuse-tegra30.c

+ 3 - 0
drivers/soc/tegra/fuse/fuse-tegra30.c

@@ -50,6 +50,9 @@
     defined(CONFIG_ARCH_TEGRA_186_SOC)
 static u32 tegra30_fuse_read_early(struct tegra_fuse *fuse, unsigned int offset)
 {
+	if (WARN_ON(!fuse->base))
+		return 0;
+
 	return readl_relaxed(fuse->base + FUSE_BEGIN + offset);
 }