RE: [PATCH v8 4/5] firmware: imx: add driver for NXP EdgeLock Enclave

From: Pankaj Gupta
Date: Tue Oct 15 2024 - 05:19:13 EST


diff --git a/drivers/firmware/imx/se_ctrl.c b/drivers/firmware/imx/se_ctrl.c
new file mode 100644 index 000000000000..37693c27042f
--- /dev/null
+++ b/drivers/firmware/imx/se_ctrl.c

+
+static void se_if_probe_cleanup(void *plat_dev) {
+ struct platform_device *pdev = plat_dev;
+ struct device *dev = &pdev->dev;
+ struct se_fw_load_info *load_fw;
+ struct se_if_priv *priv;
+
+ priv = dev_get_drvdata(dev);
+ load_fw = get_load_fw_instance(priv);
+
+ /* In se_if_request_channel(), passed the clean-up functional
+ * pointer reference as action to devm_add_action().
+ * No need to free the mbox channels here.
+ */
+
+ /* free the buffer in se remove, previously allocated
+ * in se probe to store encrypted IMEM
+ */
+ if (!load_fw && load_fw->imem.buf) {

This needs to be corrected to: if (load_fw && load_fw->imem.buf) {
Will correct in v9.

+ dmam_free_coherent(dev,
+ ELE_IMEM_SIZE,
+ load_fw->imem.buf,
+ load_fw->imem.phyaddr);
+ load_fw->imem.buf = NULL;
+ }
+
+ /* No need to check, if reserved memory is allocated
+ * before calling for its release. Or clearing the
+ * un-set bit.
+ */
+ of_reserved_mem_device_release(dev);
+}
+
+static int se_if_probe(struct platform_device *pdev) {
+ const struct se_if_node_info_list *info_list;

Attachment: smime.p7s
Description: S/MIME cryptographic signature