diff mbox series

ACPI: APEI: EINJ: Fix einj_dev release leak

Message ID 171633159194.398195.10059732788629089925.stgit@dwillia2-xfh.jf.intel.com (mailing list archive)
State Mainlined, archived
Headers show
Series ACPI: APEI: EINJ: Fix einj_dev release leak | expand

Commit Message

Dan Williams May 21, 2024, 10:46 p.m. UTC
The platform driver conversion of EINJ mistakenly used
platform_device_del() to unwind platform_device_register_full() at
module exit. This leads to a small leak of one 'struct platform_device'
instance per module load/unload cycle. Switch to
platform_device_unregister() which performs both device_del() and final
put_device().

Fixes: 5621fafaac00 ("EINJ: Migrate to a platform driver")
Cc: <stable@vger.kernel.org>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Ben Cheatham <Benjamin.Cheatham@amd.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/acpi/apei/einj-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ben Cheatham May 22, 2024, 1:40 p.m. UTC | #1
On 5/21/24 5:46 PM, Dan Williams wrote:
> The platform driver conversion of EINJ mistakenly used
> platform_device_del() to unwind platform_device_register_full() at
> module exit. This leads to a small leak of one 'struct platform_device'
> instance per module load/unload cycle. Switch to
> platform_device_unregister() which performs both device_del() and final
> put_device().
> 

Reviewed-by: Ben Cheatham <Benjamin.Cheatham@amd.com>

Thanks,
Ben

> Fixes: 5621fafaac00 ("EINJ: Migrate to a platform driver")
> Cc: <stable@vger.kernel.org>
> Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Ben Cheatham <Benjamin.Cheatham@amd.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  drivers/acpi/apei/einj-core.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/apei/einj-core.c b/drivers/acpi/apei/einj-core.c
> index 01faca3a238a..bb9f8475ce59 100644
> --- a/drivers/acpi/apei/einj-core.c
> +++ b/drivers/acpi/apei/einj-core.c
> @@ -903,7 +903,7 @@ static void __exit einj_exit(void)
>  	if (einj_initialized)
>  		platform_driver_unregister(&einj_driver);
>  
> -	platform_device_del(einj_dev);
> +	platform_device_unregister(einj_dev);
>  }
>  
>  module_init(einj_init);
>
Rafael J. Wysocki May 27, 2024, 10:36 a.m. UTC | #2
On Wed, May 22, 2024 at 3:40 PM Ben Cheatham <benjamin.cheatham@amd.com> wrote:
>
> On 5/21/24 5:46 PM, Dan Williams wrote:
> > The platform driver conversion of EINJ mistakenly used
> > platform_device_del() to unwind platform_device_register_full() at
> > module exit. This leads to a small leak of one 'struct platform_device'
> > instance per module load/unload cycle. Switch to
> > platform_device_unregister() which performs both device_del() and final
> > put_device().
> >
>
> Reviewed-by: Ben Cheatham <Benjamin.Cheatham@amd.com>

Applied as 6.10-rc material, thanks!
diff mbox series

Patch

diff --git a/drivers/acpi/apei/einj-core.c b/drivers/acpi/apei/einj-core.c
index 01faca3a238a..bb9f8475ce59 100644
--- a/drivers/acpi/apei/einj-core.c
+++ b/drivers/acpi/apei/einj-core.c
@@ -903,7 +903,7 @@  static void __exit einj_exit(void)
 	if (einj_initialized)
 		platform_driver_unregister(&einj_driver);
 
-	platform_device_del(einj_dev);
+	platform_device_unregister(einj_dev);
 }
 
 module_init(einj_init);