hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/soc/rockchip/mtd_vendor_storage.c
....@@ -47,6 +47,7 @@
4747 static u32 mtd_erase_size;
4848 static const char *vendor_mtd_name = "vnvm";
4949 static struct mtd_nand_info nand_info;
50
+static struct platform_device *g_pdev;
5051
5152 static int mtd_vendor_nand_write(void)
5253 {
....@@ -419,6 +420,8 @@
419420
420421 g_idb_buffer = NULL;
421422 ret = platform_driver_register(&vendor_storage_driver);
423
+ if (ret)
424
+ return ret;
422425
423426 pdev = platform_device_register_simple("mtd_vendor_storage",
424427 -1, NULL, 0);
....@@ -426,8 +429,17 @@
426429 platform_driver_unregister(&vendor_storage_driver);
427430 return PTR_ERR(pdev);
428431 }
432
+ g_pdev = pdev;
429433
430434 return ret;
431435 }
432436
437
+static __exit void vendor_storage_deinit(void)
438
+{
439
+ platform_device_unregister(g_pdev);
440
+ platform_driver_unregister(&vendor_storage_driver);
441
+}
442
+
433443 device_initcall_sync(vendor_storage_init);
444
+module_exit(vendor_storage_deinit);
445
+MODULE_LICENSE("GPL");