static void intel_pmc_core_release(struct device *dev)
 {
-       /* Nothing to do. */
+       kfree(dev);
 }
 
-static struct platform_device pmc_core_device = {
-       .name = "intel_pmc_core",
-       .dev  = {
-               .release = intel_pmc_core_release,
-       },
-};
+static struct platform_device *pmc_core_device;
 
 /*
  * intel_pmc_core_platform_ids is the list of platforms where we want to
 
 static int __init pmc_core_platform_init(void)
 {
+       int retval;
+
        /* Skip creating the platform device if ACPI already has a device */
        if (acpi_dev_present("INT33A1", NULL, -1))
                return -ENODEV;
        if (!x86_match_cpu(intel_pmc_core_platform_ids))
                return -ENODEV;
 
-       return platform_device_register(&pmc_core_device);
+       pmc_core_device = kzalloc(sizeof(*pmc_core_device), GFP_KERNEL);
+       if (!pmc_core_device)
+               return -ENOMEM;
+
+       pmc_core_device->name = "intel_pmc_core";
+       pmc_core_device->dev.release = intel_pmc_core_release;
+
+       retval = platform_device_register(pmc_core_device);
+       if (retval)
+               kfree(pmc_core_device);
+
+       return retval;
 }
 
 static void __exit pmc_core_platform_exit(void)
 {
-       platform_device_unregister(&pmc_core_device);
+       platform_device_unregister(pmc_core_device);
 }
 
 module_init(pmc_core_platform_init);