Message ID | 20230829070150.1217624-1-liaochang1@huawei.com (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
Series | [v2] cpufreq: Avoid printing kernel addresses in cpufreq_resume() | expand |
On 29-08-23, 07:01, Liao Chang wrote: > The pointer value of policy and driver structure are currently printed > in the error messages of cpufreq_resume(), this is not recommended and > helpful. In order to be consistent with the error message in > cpufreq_suspend() and easier to understand, print the name of driver > strcture and the manage CPU of policy structure individually in the > error messages of cpufreq_resume(). > > Link: https://lore.kernel.org/all/b7be717c-41d8-bbbf-3e97-3799948ab757@huawei.com > Signed-off-by: Liao Chang <liaochang1@huawei.com> > --- > drivers/cpufreq/cpufreq.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > index 50bbc969ffe5..26fa99d46684 100644 > --- a/drivers/cpufreq/cpufreq.c > +++ b/drivers/cpufreq/cpufreq.c > @@ -1943,16 +1943,16 @@ void cpufreq_resume(void) > > for_each_active_policy(policy) { > if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) { > - pr_err("%s: Failed to resume driver: %p\n", __func__, > - policy); > + pr_err("%s: Failed to resume driver: %s\n", __func__, > + cpufreq_driver->name); > } else if (has_target()) { > down_write(&policy->rwsem); > ret = cpufreq_start_governor(policy); > up_write(&policy->rwsem); > > if (ret) > - pr_err("%s: Failed to start governor for policy: %p\n", > - __func__, policy); > + pr_err("%s: Failed to start governor for CPU%u's policy\n", > + __func__, policy->cpu); > } > } > } Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
On Tue, Aug 29, 2023 at 9:13 AM Viresh Kumar <viresh.kumar@linaro.org> wrote: > > On 29-08-23, 07:01, Liao Chang wrote: > > The pointer value of policy and driver structure are currently printed > > in the error messages of cpufreq_resume(), this is not recommended and > > helpful. In order to be consistent with the error message in > > cpufreq_suspend() and easier to understand, print the name of driver > > strcture and the manage CPU of policy structure individually in the > > error messages of cpufreq_resume(). > > > > Link: https://lore.kernel.org/all/b7be717c-41d8-bbbf-3e97-3799948ab757@huawei.com > > Signed-off-by: Liao Chang <liaochang1@huawei.com> > > --- > > drivers/cpufreq/cpufreq.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > > index 50bbc969ffe5..26fa99d46684 100644 > > --- a/drivers/cpufreq/cpufreq.c > > +++ b/drivers/cpufreq/cpufreq.c > > @@ -1943,16 +1943,16 @@ void cpufreq_resume(void) > > > > for_each_active_policy(policy) { > > if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) { > > - pr_err("%s: Failed to resume driver: %p\n", __func__, > > - policy); > > + pr_err("%s: Failed to resume driver: %s\n", __func__, > > + cpufreq_driver->name); > > } else if (has_target()) { > > down_write(&policy->rwsem); > > ret = cpufreq_start_governor(policy); > > up_write(&policy->rwsem); > > > > if (ret) > > - pr_err("%s: Failed to start governor for policy: %p\n", > > - __func__, policy); > > + pr_err("%s: Failed to start governor for CPU%u's policy\n", > > + __func__, policy->cpu); > > } > > } > > } > > Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Applied as 6.6-rc material, thanks!
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 50bbc969ffe5..26fa99d46684 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1943,16 +1943,16 @@ void cpufreq_resume(void) for_each_active_policy(policy) { if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) { - pr_err("%s: Failed to resume driver: %p\n", __func__, - policy); + pr_err("%s: Failed to resume driver: %s\n", __func__, + cpufreq_driver->name); } else if (has_target()) { down_write(&policy->rwsem); ret = cpufreq_start_governor(policy); up_write(&policy->rwsem); if (ret) - pr_err("%s: Failed to start governor for policy: %p\n", - __func__, policy); + pr_err("%s: Failed to start governor for CPU%u's policy\n", + __func__, policy->cpu); } } }
The pointer value of policy and driver structure are currently printed in the error messages of cpufreq_resume(), this is not recommended and helpful. In order to be consistent with the error message in cpufreq_suspend() and easier to understand, print the name of driver strcture and the manage CPU of policy structure individually in the error messages of cpufreq_resume(). Link: https://lore.kernel.org/all/b7be717c-41d8-bbbf-3e97-3799948ab757@huawei.com Signed-off-by: Liao Chang <liaochang1@huawei.com> --- drivers/cpufreq/cpufreq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)