From: Thierry Reding Date: Mon, 26 Jun 2017 15:23:27 +0000 (+0200) Subject: soc/tegra: fuse: Warn if accessing unmapped registers X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=da943840bcd2b490788d73c60ac4368fb7fc7229;p=linux.git 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 --- diff --git a/drivers/soc/tegra/fuse/fuse-tegra30.c b/drivers/soc/tegra/fuse/fuse-tegra30.c index 497eb044095fe..257e254c6137f 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra30.c +++ b/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); }