فهرست منبع

qrng: fix module remove sequence

Module remove call is not cleaning up char dev completely.

Update remove call sequence to call class_destroy, device_destroy
and cdev_del to clean up char dev complexly.

Change-Id: I07f28c27ac0ca78cb8223118bd0be3b3a5654224
Signed-off-by: Om Prakash Singh <[email protected]>
Om Prakash Singh 1 سال پیش
والد
کامیت
d374955003
1فایلهای تغییر یافته به همراه4 افزوده شده و 1 حذف شده
  1. 4 1
      qrng/msm_rng.c

+ 4 - 1
qrng/msm_rng.c

@@ -2,7 +2,7 @@
 /*
  * Copyright (c) 2011-2013, 2015, 2017-2021 The Linux Foundation. All rights
  * reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -367,6 +367,9 @@ static int msm_rng_remove(struct platform_device *pdev)
 {
 	struct msm_rng_device *msm_rng_dev = platform_get_drvdata(pdev);
 
+	cdev_del(&msm_rng_cdev);
+	device_destroy(msm_rng_class, MKDEV(QRNG_IOC_MAGIC, 0));
+	class_destroy(msm_rng_class);
 	unregister_chrdev(QRNG_IOC_MAGIC, DRIVER_NAME);
 	hwrng_unregister(&msm_rng);
 	if (msm_rng_dev->prng_clk)