[PATCH] Synchronize smd commands
Olof Johansson
dev at skyshaper.net
Fri Jul 5 06:43:44 EDT 2013
On Fri, Jul 5, 2013 at 12:30 PM, Eugene Krasnikov <k.eugene.e at gmail.com> wrote:
> static int wcn36xx_smd_send_and_wait(struct wcn36xx *wcn, size_t len)
> {
> int avail;
> + int ret = 0;
>
> init_completion(&wcn->smd_compl);
> avail = smd_write_avail(wcn->smd_ch);
> @@ -29,19 +30,28 @@ static int wcn36xx_smd_send_and_wait(struct wcn36xx *wcn, size_t len)
> avail = smd_write(wcn->smd_ch, wcn->smd_buf, len);
> if (avail != len) {
> wcn36xx_error("Cannot write to SMD channel");
> - return -EAGAIN;
> + ret = -EAGAIN;
> + goto out;
> +
> }
> } else {
> wcn36xx_error("SMD channel can accept only %d bytes", avail);
> - return -ENOMEM;
> + ret = -ENOMEM;
> + goto out;
> +
> }
>
> if (wait_for_completion_timeout(&wcn->smd_compl,
> msecs_to_jiffies(SMD_MSG_TIMEOUT)) <= 0) {
> wcn36xx_error("Timeout while waiting SMD response");
> - return -ETIME;
> + ret = -ETIME;
> + goto out;
> +
Extra linebreaks after the gotos, but the rest looks good.
Nice work!
Cheers
--
Olof
More information about the wcn36xx
mailing list