Skip to content

Commit 51c4b4e

Browse files
arnopoandersson
authored andcommitted
remoteproc: stm32: fix mbox_send_message call
mbox_send_message is called by passing a local dummy message or a function parameter. As the message is queued, it is dereferenced. This works because the message field is not used by the stm32 ipcc driver, but it is not clean. Fix by passing a constant string in all cases. The associated comments are removed because rproc should not have to deal with the behavior of the mailbox frame. Reported-by: Bjorn Andersson <[email protected]> Signed-off-by: Arnaud Pouliquen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 7dbdb8b commit 51c4b4e

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

drivers/remoteproc/stm32_rproc.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -474,14 +474,12 @@ static int stm32_rproc_attach(struct rproc *rproc)
474474
static int stm32_rproc_detach(struct rproc *rproc)
475475
{
476476
struct stm32_rproc *ddata = rproc->priv;
477-
int err, dummy_data, idx;
477+
int err, idx;
478478

479479
/* Inform the remote processor of the detach */
480480
idx = stm32_rproc_mbox_idx(rproc, STM32_MBX_DETACH);
481481
if (idx >= 0 && ddata->mb[idx].chan) {
482-
/* A dummy data is sent to allow to block on transmit */
483-
err = mbox_send_message(ddata->mb[idx].chan,
484-
&dummy_data);
482+
err = mbox_send_message(ddata->mb[idx].chan, "stop");
485483
if (err < 0)
486484
dev_warn(&rproc->dev, "warning: remote FW detach without ack\n");
487485
}
@@ -493,15 +491,13 @@ static int stm32_rproc_detach(struct rproc *rproc)
493491
static int stm32_rproc_stop(struct rproc *rproc)
494492
{
495493
struct stm32_rproc *ddata = rproc->priv;
496-
int err, dummy_data, idx;
494+
int err, idx;
497495

498496
/* request shutdown of the remote processor */
499497
if (rproc->state != RPROC_OFFLINE) {
500498
idx = stm32_rproc_mbox_idx(rproc, STM32_MBX_SHUTDOWN);
501499
if (idx >= 0 && ddata->mb[idx].chan) {
502-
/* a dummy data is sent to allow to block on transmit */
503-
err = mbox_send_message(ddata->mb[idx].chan,
504-
&dummy_data);
500+
err = mbox_send_message(ddata->mb[idx].chan, "detach");
505501
if (err < 0)
506502
dev_warn(&rproc->dev, "warning: remote FW shutdown without ack\n");
507503
}
@@ -556,7 +552,7 @@ static void stm32_rproc_kick(struct rproc *rproc, int vqid)
556552
continue;
557553
if (!ddata->mb[i].chan)
558554
return;
559-
err = mbox_send_message(ddata->mb[i].chan, (void *)(long)vqid);
555+
err = mbox_send_message(ddata->mb[i].chan, "kick");
560556
if (err < 0)
561557
dev_err(&rproc->dev, "%s: failed (%s, err:%d)\n",
562558
__func__, ddata->mb[i].name, err);

0 commit comments

Comments
 (0)