lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240221154457.2007420-1-arnd@kernel.org>
Date: Wed, 21 Feb 2024 16:44:51 +0100
From: Arnd Bergmann <arnd@...nel.org>
To: Bjorn Andersson <andersson@...nel.org>,
	Konrad Dybcio <konrad.dybcio@...aro.org>,
	Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
Cc: Arnd Bergmann <arnd@...db.de>,
	Rob Herring <robh@...nel.org>,
	Yangtao Li <frank.li@...o.com>,
	linux-arm-msm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] soc: qcom: spm: fix building with CONFIG_REGULATOR=n

From: Arnd Bergmann <arnd@...db.de>

The newly added code causes a build failure when -Werror is set:

drivers/soc/qcom/spm.c:388:12: error: 'spm_get_cpu' defined but not used [-Werror=unused-function]

Remove the #ifdef and instead use an IS_ENABLED() check that lets the
compiler perform dead code elimination instead of the preprocessor.

Fixes: 6496dba142f4 ("soc: qcom: spm: add support for voltage regulator")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
 drivers/soc/qcom/spm.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/soc/qcom/spm.c b/drivers/soc/qcom/spm.c
index 5eefaec72a13..06e2c4c2a4a8 100644
--- a/drivers/soc/qcom/spm.c
+++ b/drivers/soc/qcom/spm.c
@@ -411,7 +411,6 @@ static int spm_get_cpu(struct device *dev)
 	return -EOPNOTSUPP;
 }
 
-#ifdef CONFIG_REGULATOR
 static int spm_register_regulator(struct device *dev, struct spm_driver_data *drv)
 {
 	struct regulator_config config = {
@@ -474,12 +473,6 @@ static int spm_register_regulator(struct device *dev, struct spm_driver_data *dr
 
 	return 0;
 }
-#else
-static int spm_register_regulator(struct device *dev, struct spm_driver_data *drv)
-{
-	return 0;
-}
-#endif
 
 static const struct of_device_id spm_match_table[] = {
 	{ .compatible = "qcom,sdm660-gold-saw2-v4.1-l2",
@@ -559,7 +552,10 @@ static int spm_dev_probe(struct platform_device *pdev)
 	if (drv->reg_data->reg_offset[SPM_REG_SPM_CTL])
 		spm_set_low_power_mode(drv, PM_SLEEP_MODE_STBY);
 
-	return spm_register_regulator(&pdev->dev, drv);
+	if (IS_ENABLED(CONFIG_REGULATOR))
+		return spm_register_regulator(&pdev->dev, drv);
+
+	return 0;
 }
 
 static struct platform_driver spm_driver = {
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ