When sending an SCPI command we aquire a channel and queue the
message in the mailbox. If the queuing failed we were not releasing
the channel hence preventing everyone else from using it.
Signed-off-by: Punit Agrawal <Punit.Agrawal@arm.com>
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
return PTR_ERR(chan);
init_completion(&scpi_buf->complete);
- if (mbox_send_message(chan, (void *)data))
- return -EIO;
+ if (mbox_send_message(chan, (void *)data) < 0) {
+ status = SCPI_ERR_TIMEOUT;
+ goto free_channel;
+ }
if (!wait_for_completion_timeout(&scpi_buf->complete,
msecs_to_jiffies(50)))
else
status = *(u32 *)(data->rx_buf); /* read first word */
+free_channel:
mbox_free_channel(chan);
return scpi_to_linux_errno(status);