Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] firmware: samsung: acpm: remove compile-testing stubs
@ 2026-05-29 13:43 Arnd Bergmann
  2026-05-29 14:07 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2026-05-29 13:43 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Sylwester Nawrocki, Chanwoo Choi,
	Michael Turquette, Stephen Boyd, Tudor Ambarus
  Cc: Arnd Bergmann, Alim Akhtar, Brian Masney, Peter Griffin,
	linux-samsung-soc, linux-clk, linux-kernel, linux-arm-kernel

From: Arnd Bergmann <arnd@arndb.de>

Sashiko reported an inconsistent use of NULL vs ERR_PTR()
returns in the stub helpers in xynos-acpm-protocol.h.

Since this only happens on dead code for COMPILE_TEST=y, this is not
really a bug though.  Having stub functions that return NULL is a common
way to define optional interfaces, where callers still work when the
feature is disabled, though this clearly does not work for acpm because
some callers have a NULL pointer dereference when compile testing.

Since CONFIG_EXYNOS_ACPM_PROTOCOL already supports compile-testing itself,
and all (both) drivers using it clearly require the support, so this
just simplifies the option space without losing any build coverage.

Remove the stub functions entirely and adjust the one Kconfig
dependency to require EXYNOS_ACPM_PROTOCOL unconditionally.

Fixes: 6837c006d4e7 ("firmware: exynos-acpm: add empty method to allow compile test")
Closes: https://sashiko.dev/#/patchset/20260420-acpm-tmu-v3-0-3dc8e93f0b26%40linaro.org
Link: https://lore.kernel.org/all/a7994860-24a3-4f87-84bf-109ed653dda4@linaro.org/
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/clk/samsung/Kconfig                        |  2 +-
 .../linux/firmware/samsung/exynos-acpm-protocol.h  | 14 --------------
 2 files changed, 1 insertion(+), 15 deletions(-)

diff --git a/drivers/clk/samsung/Kconfig b/drivers/clk/samsung/Kconfig
index 70a8b82a0136..198d8b621289 100644
--- a/drivers/clk/samsung/Kconfig
+++ b/drivers/clk/samsung/Kconfig
@@ -97,7 +97,7 @@ config EXYNOS_CLKOUT
 
 config EXYNOS_ACPM_CLK
 	tristate "Clock driver controlled via ACPM interface"
-	depends on EXYNOS_ACPM_PROTOCOL || (COMPILE_TEST && !EXYNOS_ACPM_PROTOCOL)
+	depends on EXYNOS_ACPM_PROTOCOL
 	help
 	  This driver provides support for clocks that are controlled by
 	  firmware that implements the ACPM interface.
diff --git a/include/linux/firmware/samsung/exynos-acpm-protocol.h b/include/linux/firmware/samsung/exynos-acpm-protocol.h
index 83cbd425b652..c73aea30d960 100644
--- a/include/linux/firmware/samsung/exynos-acpm-protocol.h
+++ b/include/linux/firmware/samsung/exynos-acpm-protocol.h
@@ -68,22 +68,8 @@ struct acpm_handle {
 
 struct device;
 
-#if IS_ENABLED(CONFIG_EXYNOS_ACPM_PROTOCOL)
 struct acpm_handle *devm_acpm_get_by_node(struct device *dev,
 					  struct device_node *np);
 struct acpm_handle *devm_acpm_get_by_phandle(struct device *dev);
-#else
-
-static inline struct acpm_handle *devm_acpm_get_by_node(struct device *dev,
-							struct device_node *np)
-{
-	return ERR_PTR(-ENODEV);
-}
-
-static inline struct acpm_handle *devm_acpm_get_by_phandle(struct device *dev)
-{
-	return ERR_PTR(-ENODEV);
-}
-#endif
 
 #endif /* __EXYNOS_ACPM_PROTOCOL_H */
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] firmware: samsung: acpm: remove compile-testing stubs
  2026-05-29 13:43 [PATCH] firmware: samsung: acpm: remove compile-testing stubs Arnd Bergmann
@ 2026-05-29 14:07 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2026-05-29 14:07 UTC (permalink / raw)
  To: Sylwester Nawrocki, Chanwoo Choi, Michael Turquette, Stephen Boyd,
	Tudor Ambarus, Arnd Bergmann
  Cc: Arnd Bergmann, Alim Akhtar, Brian Masney, Peter Griffin,
	linux-samsung-soc, linux-clk, linux-kernel, linux-arm-kernel


On Fri, 29 May 2026 15:43:31 +0200, Arnd Bergmann wrote:
> Sashiko reported an inconsistent use of NULL vs ERR_PTR()
> returns in the stub helpers in xynos-acpm-protocol.h.
> 
> Since this only happens on dead code for COMPILE_TEST=y, this is not
> really a bug though.  Having stub functions that return NULL is a common
> way to define optional interfaces, where callers still work when the
> feature is disabled, though this clearly does not work for acpm because
> some callers have a NULL pointer dereference when compile testing.
> 
> [...]

Applied, thanks!

[1/1] firmware: samsung: acpm: remove compile-testing stubs
      https://git.kernel.org/krzk/linux/c/7b661285aa7507eab79efff0a418445157db4141

Best regards,
-- 
Krzysztof Kozlowski <krzk@kernel.org>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-29 14:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-29 13:43 [PATCH] firmware: samsung: acpm: remove compile-testing stubs Arnd Bergmann
2026-05-29 14:07 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox