Re: [PATCH v1 4/5] cpuidle: Add Tegra194 cpuidle driver

From: Dmitry Osipenko
Date: Fri Mar 05 2021 - 08:51:00 EST


04.03.2021 09:08, Sowjanya Komatineni пишет:
...
> +static int __init tegra194_cpuidle_probe(struct platform_device *pdev)
> +{
> + struct cpumask *cpumask;
> + int cpu, ret;
> +
> + if (!check_mce_version()) {
> + pr_err("cpuidle: incompatible MCE version, cannot register driver\n");

Should be dev_err() everywhere.

> + return -ENODEV;
> + }
> +
> + tsc_per_usec = arch_timer_get_cntfrq() / 1000000;
> +
> + cpumask = devm_kzalloc(&pdev->dev, cpumask_size(), GFP_KERNEL);
> + for_each_online_cpu(cpu)
> + cpumask_set_cpu(cpu, cpumask);

cpumask_copy(..)?

> + t194_cpu_idle_driver.cpumask = cpumask;

Depending on 'online' mask instead of the 'present' mask looks odd. Is
this really intended to be so?

...
> +static int tegra194_cpuidle_remove(struct platform_device *pdev)
> +{
> + unregister_pm_notifier(&suspend_notifier);
> + cpuhp_remove_state(hp_state);
> + cpuidle_unregister(&t194_cpu_idle_driver);
> + kfree(t194_cpu_idle_driver.cpumask);

kfree() of a managed resource.