mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-18 12:45:08 +00:00
i2c: imx: fix handling of wait_for_completion_timeout result
wait_for_completion_timeout does not return negative values so "result" handling here should be simplified to cover the actually possible cases only. Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:
parent
387f0de6c3
commit
cb9eaba4c5
1 changed files with 4 additions and 4 deletions
|
@ -628,9 +628,9 @@ static int i2c_imx_dma_write(struct imx_i2c_struct *i2c_imx,
|
||||||
result = wait_for_completion_timeout(
|
result = wait_for_completion_timeout(
|
||||||
&i2c_imx->dma->cmd_complete,
|
&i2c_imx->dma->cmd_complete,
|
||||||
msecs_to_jiffies(DMA_TIMEOUT));
|
msecs_to_jiffies(DMA_TIMEOUT));
|
||||||
if (result <= 0) {
|
if (result == 0) {
|
||||||
dmaengine_terminate_all(dma->chan_using);
|
dmaengine_terminate_all(dma->chan_using);
|
||||||
return result ?: -ETIMEDOUT;
|
return -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Waiting for transfer complete. */
|
/* Waiting for transfer complete. */
|
||||||
|
@ -686,9 +686,9 @@ static int i2c_imx_dma_read(struct imx_i2c_struct *i2c_imx,
|
||||||
result = wait_for_completion_timeout(
|
result = wait_for_completion_timeout(
|
||||||
&i2c_imx->dma->cmd_complete,
|
&i2c_imx->dma->cmd_complete,
|
||||||
msecs_to_jiffies(DMA_TIMEOUT));
|
msecs_to_jiffies(DMA_TIMEOUT));
|
||||||
if (result <= 0) {
|
if (result == 0) {
|
||||||
dmaengine_terminate_all(dma->chan_using);
|
dmaengine_terminate_all(dma->chan_using);
|
||||||
return result ?: -ETIMEDOUT;
|
return -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* waiting for transfer complete. */
|
/* waiting for transfer complete. */
|
||||||
|
|
Loading…
Add table
Reference in a new issue