kernel/arch/x86/kernel/pmem.c
.. .. @@ -27,6 +27,11 @@ 27 27 * simply here to trigger the module to load on demand. 28 28 */ 29 29 pdev = platform_device_alloc("e820_pmem", -1); 30 - return platform_device_add(pdev);30 +31 + rc = platform_device_add(pdev);32 + if (rc)33 + platform_device_put(pdev);34 +35 + return rc;31 36 } 32 37 device_initcall(register_e820_pmem);