[PATCH AUTOSEL 6.19-5.10] clocksource/drivers/timer-integrator-ap: Add missing Kconfig dependency on OF

Sasha Levin
2026-02-12T01:10:21Z

From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

[ Upstream commit 2246464821e2820572e6feefca2029f17629cc50 ]

This driver accesses the of_aliases global variable declared in
linux/of.h and defined in drivers/base/of.c. It requires OF support or
will cause a link failure. Add the missing Kconfig dependency.

Closes: https://lore.kernel.org/oe-kbuild-all/202601152233.og6LdeUo-lkp@intel.com/
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://patch.msgid.link/20260116111723.10585-1-bartosz.golaszewski@oss.qualcomm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

The key observation is that the `extern` declarations for `of_root`,
`of_chosen`, `of_aliases`, `of_stdout` at lines 141-144 are **outside
any `#ifdef CONFIG_OF`** guard. They are visible regardless of
CONFIG_OF. But the actual definition of `of_aliases` only exists in
`drivers/of/base.c` which is only compiled when `CONFIG_OF=y`.

This means:
1. When `CONFIG_OF=n` and `CONFIG_COMPILE_TEST=y`, the
`INTEGRATOR_AP_TIMER` config can be enabled
2. The driver compiles fine (the extern declaration is visible)
3. But at link time, there is no definition for `of_aliases` → **linker
error**

## Summary of Analysis

**Commit:** Adds `depends on OF` to `INTEGRATOR_AP_TIMER` Kconfig
option.

### 1. What Problem Does It Fix?

This is a **build fix** — it prevents a **link failure** when
`CONFIG_INTEGRATOR_AP_TIMER=y` with `CONFIG_COMPILE_TEST=y` but
`CONFIG_OF=n`. The driver `timer-integrator-ap.c` directly references
the global variable `of_aliases` (at lines 181 and 201), which is
defined in `drivers/of/base.c`. That file is only compiled when
`CONFIG_OF=y` (per `drivers/Makefile`: `obj-$(CONFIG_OF) += of/`).
Without `depends on OF`, the Kconfig allows enabling the driver in
configurations where OF is disabled, causing an unresolved symbol at
link time.

This was reported by Intel's kbuild test robot (automated build
testing), confirming it's a real, reproducible build failure.

### 2. Stable Kernel Rules Assessment

- **Obviously correct and tested**: Yes. It's a one-line Kconfig
dependency addition. The driver uses `of_aliases` and multiple OF APIs
(`of_io_request_and_map`, `of_clk_get`, `of_property_read_string`,
`of_find_node_by_path`, `of_node_put`, `irq_of_parse_and_map`,
`TIMER_OF_DECLARE`). It clearly requires `CONFIG_OF`.
- **Fixes a real bug**: Yes — a link failure preventing kernel
compilation in certain configurations.
- **Fixes an important issue**: Build fixes are explicitly listed as
backport-worthy in the stable rules. A link error prevents anyone from
building the kernel with that configuration.
- **Small and contained**: Yes — single line addition to a Kconfig file.
Zero risk of runtime regression.
- **No new features**: Correct — this only adds a constraint on when the
driver can be selected.

### 3. Risk vs Benefit

- **Risk**: Essentially zero. Adding a Kconfig `depends on OF` only
narrows the set of configurations where this driver can be enabled.
Since the driver fundamentally requires OF to work (it uses OF APIs
throughout), this is purely corrective. No runtime behavior changes.
- **Benefit**: Fixes a real build failure that prevents kernel
compilation.

### 4. Scope

- **One line changed** in `drivers/clocksource/Kconfig`
- **One file affected**
- No code logic changes, no runtime impact

### 5. Affected Versions

The bug has existed since commit `568c0342e494` (June 2016, v4.8 cycle)
when `COMPILE_TEST` was added to `INTEGRATOR_AP_TIMER`. All current
stable trees (5.4.y through 6.12.y) are affected and the patch applies
cleanly since the surrounding Kconfig hasn't changed.

### 6. Dependencies

None. This is completely self-contained.

### 7. Classification

This is a **build fix** — one of the explicitly listed categories for
stable backporting. Build fixes are critical because they affect anyone
who needs to compile the kernel with a particular configuration. Even
though this specific configuration (COMPILE_TEST=y, OF=n) may not be
common for production kernels (since the Integrator/AP platform always
has OF), it matters for:
- Automated build testing infrastructure (like Intel's kbuild)
- Distributions running `make allmodconfig` / `make allyesconfig`
testing
- Developers using COMPILE_TEST for coverage

The fix is small, surgical, zero-risk, and meets all stable kernel
criteria perfectly.

**YES**

drivers/clocksource/Kconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index aa59e5b133510..fd91127065454 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -254,6 +254,7 @@ config KEYSTONE_TIMER

config INTEGRATOR_AP_TIMER
bool "Integrator-AP timer driver" if COMPILE_TEST
+ depends on OF
select CLKSRC_MMIO
help
Enables support for the Integrator-AP timer.
--
2.51.0