diff options
author | Franck LENORMAND <franck.lenormand@nxp.com> | 2020-03-25 16:47:18 +0100 |
---|---|---|
committer | Franck LENORMAND <franck.lenormand@nxp.com> | 2020-04-24 11:46:16 +0200 |
commit | 1edd6bc2e9cafb513aba32b697baec68e04ccb63 (patch) | |
tree | 363a0404d8aa15911c84ef997ce5b13e576c2171 /drivers/mailbox/imx-mailbox.c | |
parent | 52589138948df99c100bb2cc9095f21f965bf7e1 (diff) |
HSM-267-2: mailbox: imx: Send failure to read to client
In case the reception of the message fails, the client is not
informed.
This patch sends the error to client using mbox_chan_received_data
with error code encoded in the address of the message.
Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Diffstat (limited to 'drivers/mailbox/imx-mailbox.c')
-rw-r--r-- | drivers/mailbox/imx-mailbox.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c index 2a8c3e8aefb5..1ed86994859e 100644 --- a/drivers/mailbox/imx-mailbox.c +++ b/drivers/mailbox/imx-mailbox.c @@ -279,7 +279,7 @@ static int imx_mu_seco_rxdb(struct imx_mu_priv *priv, struct imx_mu_con_priv *cp struct imx_sc_rpc_msg_max msg; u32 *data = (u32 *)&msg; u32 byte_size; - int err; + int err = 0; int i; dev_dbg(priv->dev, "Receiving message\n"); @@ -291,7 +291,8 @@ static int imx_mu_seco_rxdb(struct imx_mu_priv *priv, struct imx_mu_con_priv *cp if (byte_size > sizeof(msg)) { dev_err(priv->dev, "Exceed max msg size (%li) on RX, got: %i\n", sizeof(msg), byte_size); - return -EINVAL; + err = -EINVAL; + goto error; } /* Read message waiting they are written */ @@ -300,7 +301,7 @@ static int imx_mu_seco_rxdb(struct imx_mu_priv *priv, struct imx_mu_con_priv *cp err = imx_mu_rx_waiting_read(priv, i, data++); if (err) { dev_err(priv->dev, "Timeout rx %d\n", i); - return err; + goto error; } } @@ -314,7 +315,13 @@ static int imx_mu_seco_rxdb(struct imx_mu_priv *priv, struct imx_mu_con_priv *cp dev_dbg(priv->dev, "Sending message to client\n"); mbox_chan_received_data(cp->chan, (void *)&msg); - return 0; + goto exit; + +error: + mbox_chan_received_data(cp->chan, ERR_PTR(err)); + +exit: + return err; } static void imx_mu_txdb_tasklet(unsigned long data) |