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>5.4-rM2-2.2.x-imx-squashed
parent
5258913894
commit
1edd6bc2e9
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue