Skip to contentSkip to conversation

firmware: stratix10-svc: fix bug in saving controller data

PATCH Applied Khairul Anuar Romli 2 participants 3 messages Nov 2, 2025 – Nov 3, 2025 1 message not in the archive Intel STRATIX10 firmware drivers

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v3 1/1 firmware: stratix10-svc: fix bug in saving controller data

Fix the incorrect usage of platform_set_drvdata and dev_set_drvdata. They both are of the same data and overrides each other. This resulted in the rmmod of the svc driver to fail and throw a kernel panic for kthread_stop and fifo free.

Fixes b5dc75c915cda ("firmware: stratix10-svc: extend svc to support new RSU features")

---
Changes in v3:
- Rebase on v6.18-rc1
- correct cc -> Cc
- Include link to original patch that was not sent in 2023 but was not merged.
Changes in v2:
- Add CC that was missed in the v1 and original patch from 2023

 drivers/firmware/stratix10-svc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/firmware/stratix10-svc.c +4 -3
index e3f990d888d7..00f58e27f6de 100644
@@ -134,6 +134,7 @@ struct stratix10_svc_data {
  * @complete_status: state for completion
  * @svc_fifo_lock: protect access to service message data queue
  * @invoke_fn: function to issue secure monitor call or hypervisor call
+ * @svc: manages the list of client svc drivers
  *
  * This struct is used to create communication channels for service clients, to
  * handle secure monitor or hypervisor call.
@@ -150,6 +151,7 @@ struct stratix10_svc_controller {
 	struct completion complete_status;
 	spinlock_t svc_fifo_lock;
 	svc_invoke_fn *invoke_fn;
+	struct stratix10_svc *svc;
 };
 
 /**
@@ -1206,6 +1208,7 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
 		ret = -ENOMEM;
 		goto err_free_kfifo;
 	}
+	controller->svc = svc;
 
 	svc->stratix10_svc_rsu = platform_device_alloc(STRATIX10_RSU, 0);
 	if (!svc->stratix10_svc_rsu) {
@@ -1237,8 +1240,6 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_unregister_fcs_dev;
 
-	dev_set_drvdata(dev, svc);
-
 	pr_info("Intel Service Layer Driver Initialized\n");
 
 	return 0;
@@ -1256,8 +1257,8 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
 
 static void stratix10_svc_drv_remove(struct platform_device *pdev)
 {
-	struct stratix10_svc *svc = dev_get_drvdata(&pdev->dev);
 	struct stratix10_svc_controller *ctrl = platform_get_drvdata(pdev);
+	struct stratix10_svc *svc = ctrl->svc;
 
 	of_platform_depopulate(ctrl->dev);
 
Signature · 1 line
2.43.7
maintainer Applied
#2 lore raw
Quoted 6 lines · Khairul Anuar Romli

Fix the incorrect usage of platform_set_drvdata and dev_set_drvdata. They both are of the same data and overrides each other. This resulted in the rmmod of the svc driver to fail and throw a kernel panic for kthread_stop and fifo free.

Fixes b5dc75c915cda ("firmware: stratix10-svc: extend svc to support new RSU features")

Trimming this to 12 characters SHA. I know that documentation says at least 12, and not exactly 12, but the normal procedure is to use exactly 12.

Applied!

Thanks,
Dinh

#3 lore raw
Quoted 11 lines · Dinh Nguyen
Quoted 7 lines · Khairul Anuar Romli

Fix the incorrect usage of platform_set_drvdata and dev_set_drvdata. They both are of the same data and overrides each other. This resulted in the rmmod of the svc driver to fail and throw a kernel panic for kthread_stop and fifo free.

Fixes b5dc75c915cda ("firmware: stratix10-svc: extend svc to support

new RSU features")

Quoted 8 lines

Trimming this to 12 characters SHA. I know that documentation says at least 12, and not exactly 12, but the normal procedure is to use exactly 12.

Applied!

Thanks,
Dinh

Noted. Thanks for helping out to trim it to 12 chars.

Best Regards,
Khairul