ia64/xen-unstable

changeset 18727:101e50cffc78

x86/powernow: fix machine shutdown

cpufreq_del_cpu() calls cpufreq_driver->exit() without checking
whether an exit() handler is present, and by adding an exit() handler
to powernow we can at once close the potential memory leak.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Oct 27 13:20:52 2008 +0000 (2008-10-27)
parents 537d480b7ffc
children 11c86c51a697
files xen/arch/x86/acpi/cpufreq/powernow.c
line diff
     1.1 --- a/xen/arch/x86/acpi/cpufreq/powernow.c	Mon Oct 27 11:56:57 2008 +0000
     1.2 +++ b/xen/arch/x86/acpi/cpufreq/powernow.c	Mon Oct 27 13:20:52 2008 +0000
     1.3 @@ -229,9 +229,23 @@ err_unreg:
     1.4      return result;
     1.5  }
     1.6  
     1.7 +static int powernow_cpufreq_cpu_exit(struct cpufreq_policy *policy)
     1.8 +{
     1.9 +    struct powernow_cpufreq_data *data = drv_data[policy->cpu];
    1.10 +
    1.11 +    if (data) {
    1.12 +        drv_data[policy->cpu] = NULL;
    1.13 +        xfree(data->freq_table);
    1.14 +        xfree(data);
    1.15 +    }
    1.16 +
    1.17 +    return 0;
    1.18 +}
    1.19 +
    1.20  static struct cpufreq_driver powernow_cpufreq_driver = {
    1.21      .target = powernow_cpufreq_target,
    1.22      .init   = powernow_cpufreq_cpu_init,
    1.23 +    .exit   = powernow_cpufreq_cpu_exit
    1.24  };
    1.25  
    1.26  int powernow_cpufreq_init(void)