On Fri, Jun 3, 2016 at 3:35 PM, Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote: > The cpufreq core doesn't use these tables anymore after > cpufreq_table_validate_and_show() has returned. And so these can be > freed early. That doesn't look particularly efficient. The driver has to allocate memory first and populate it and then the core needs to allocate more memory again to store the same information in it, but perhaps in a different order and then the driver can free the memory allocated before right away. It looks like there's one excessive memory allocation here, so maybe the core can simply sort the frequency table in place and overwrite the invalid entries in the process?