Skip to content

Commit d0fcf70

Browse files
kromliDinh Nguyen
authored andcommitted
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: b5dc75c ("firmware: stratix10-svc: extend svc to support new RSU features") Cc: stable@vger.kernel.org # 6.6+ Signed-off-by: Ang Tien Sung <tiensung.ang@altera.com> Signed-off-by: Khairul Anuar Romli <khairul.anuar.romli@altera.com> Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
1 parent 6146a0f commit d0fcf70

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

drivers/firmware/stratix10-svc.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ struct stratix10_svc_data {
134134
* @complete_status: state for completion
135135
* @svc_fifo_lock: protect access to service message data queue
136136
* @invoke_fn: function to issue secure monitor call or hypervisor call
137+
* @svc: manages the list of client svc drivers
137138
*
138139
* This struct is used to create communication channels for service clients, to
139140
* handle secure monitor or hypervisor call.
@@ -150,6 +151,7 @@ struct stratix10_svc_controller {
150151
struct completion complete_status;
151152
spinlock_t svc_fifo_lock;
152153
svc_invoke_fn *invoke_fn;
154+
struct stratix10_svc *svc;
153155
};
154156

155157
/**
@@ -1206,6 +1208,7 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
12061208
ret = -ENOMEM;
12071209
goto err_free_kfifo;
12081210
}
1211+
controller->svc = svc;
12091212

12101213
svc->stratix10_svc_rsu = platform_device_alloc(STRATIX10_RSU, 0);
12111214
if (!svc->stratix10_svc_rsu) {
@@ -1237,8 +1240,6 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
12371240
if (ret)
12381241
goto err_unregister_fcs_dev;
12391242

1240-
dev_set_drvdata(dev, svc);
1241-
12421243
pr_info("Intel Service Layer Driver Initialized\n");
12431244

12441245
return 0;
@@ -1256,8 +1257,8 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
12561257

12571258
static void stratix10_svc_drv_remove(struct platform_device *pdev)
12581259
{
1259-
struct stratix10_svc *svc = dev_get_drvdata(&pdev->dev);
12601260
struct stratix10_svc_controller *ctrl = platform_get_drvdata(pdev);
1261+
struct stratix10_svc *svc = ctrl->svc;
12611262

12621263
of_platform_depopulate(ctrl->dev);
12631264

0 commit comments

Comments
 (0)