[PATCH] cpufreq: sti: avoid NULL dereference in dev_err()

From: Xueqin Luo

Date: Mon Aug 31 2026 - 05:20:13 EST


ddata.cpu is NULL-checked, then immediately passed to dev_err().
Replace with pr_err() to avoid dereferencing NULL.

Fixes: ab0ea257fc58 ("cpufreq: st: Provide runtime initialised driver for ST's platforms")
Signed-off-by: Xueqin Luo <luoxueqin@xxxxxxxxxx>
---
drivers/cpufreq/sti-cpufreq.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/sti-cpufreq.c b/drivers/cpufreq/sti-cpufreq.c
index b15b3142b5fe..144ac0f1d85d 100644
--- a/drivers/cpufreq/sti-cpufreq.c
+++ b/drivers/cpufreq/sti-cpufreq.c
@@ -263,7 +263,7 @@ static int __init sti_cpufreq_init(void)

ddata.cpu = get_cpu_device(0);
if (!ddata.cpu) {
- dev_err(ddata.cpu, "Failed to get device for CPU0\n");
+ pr_err("Failed to get device for CPU0\n");
goto skip_voltage_scaling;
}

@@ -281,7 +281,7 @@ static int __init sti_cpufreq_init(void)
goto register_cpufreq_dt;

skip_voltage_scaling:
- dev_err(ddata.cpu, "Not doing voltage scaling\n");
+ pr_err("Not doing voltage scaling\n");

register_cpufreq_dt:
platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
--
2.43.0