Skip to contentSkip to conversation

soc: qcom: pd-mapper: mark qcom_pdm_domains as __maybe_unused

PATCH Applied Arnd Bergmann 3 participants 3 messages Jul 19, 2024 – Jul 29, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc: qcom: pd-mapper: mark qcom_pdm_domains as __maybe_unused

From: Arnd Bergmann <[email protected]>

The qcom_pdm_domains[] array is used only when passing it into of_match_node() but is not also referenced by MODULE_DEVICE_TABLE() or the platform driver as a table. When CONFIG_OF is disabled, this causes a harmless build warning:

drivers/soc/qcom/qcom_pd_mapper.c:520:34: error: 'qcom_pdm_domains' defined but not used [-Werror=unused-const-variable=]

Avoid this by marking the variable as __maybe_unused. This also makes it clear that anything referenced by it will be dropped by the compiler when it is unused.

Fixes 1ebcde047c54 ("soc: qcom: add pd-mapper implementation")
---
 drivers/soc/qcom/qcom_pd_mapper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/qcom_pd_mapper.c +1 -1
index a4c007080665..9afa09c3920e 100644
@@ -517,7 +517,7 @@ static const struct qcom_pdm_domain_data *sm8550_domains[] = {
 	NULL,
 };
 
-static const struct of_device_id qcom_pdm_domains[] = {
+static const struct of_device_id qcom_pdm_domains[] __maybe_unused = {
 	{ .compatible = "qcom,apq8064", .data = NULL, },
 	{ .compatible = "qcom,apq8074", .data = NULL, },
 	{ .compatible = "qcom,apq8084", .data = NULL, },
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The qcom_pdm_domains[] array is used only when passing it into of_match_node() but is not also referenced by MODULE_DEVICE_TABLE() or the platform driver as a table. When CONFIG_OF is disabled, this causes a harmless build warning:

drivers/soc/qcom/qcom_pd_mapper.c:520:34: error: 'qcom_pdm_domains' defined but not used [-Werror=unused-const-variable=]

Avoid this by marking the variable as __maybe_unused. This also makes it clear that anything referenced by it will be dropped by the compiler when it is unused.

Quoted 6 lines
Fixes 1ebcde047c54 ("soc: qcom: add pd-mapper implementation")
---
 drivers/soc/qcom/qcom_pd_mapper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 2 lines
With best wishes
Dmitry
maintainer Applied
#2 lore raw
In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann

The qcom_pdm_domains[] array is used only when passing it into of_match_node() but is not also referenced by MODULE_DEVICE_TABLE() or the platform driver as a table. When CONFIG_OF is disabled, this causes a harmless build warning:

drivers/soc/qcom/qcom_pd_mapper.c:520:34: error: 'qcom_pdm_domains' defined but not used [-Werror=unused-const-variable=]

Avoid this by marking the variable as __maybe_unused. This also makes it clear that anything referenced by it will be dropped by the compiler when it is unused.

[...]

Applied, thanks!

[1/1] soc: qcom: pd-mapper: mark qcom_pdm_domains as __maybe_unused

      commit: dbd6bd124e34f9f859271ed9ae2afc39f36c7e8c

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>