Commit 7ca2b1c6 authored by Octavian Purdila's avatar Octavian Purdila Committed by Lee Jones

mfd: dln2: Fix _dln2_transfer return code

If wait_for_completion_interruptible_timeout returns a positive value
it may be propagated as the return value of _dln2_transfer. This
contradicts the documentation of the function and exposes unnecessary
internals to the callers.

This patch makes sure to set the return value to 0 in that case.
Reported-by: default avatarJulia Lawall <julia.lawall@lip6.fr>
Signed-off-by: default avatarOctavian Purdila <octavian.purdila@intel.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 6732127f
...@@ -462,6 +462,8 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd, ...@@ -462,6 +462,8 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd,
if (!ret) if (!ret)
ret = -ETIMEDOUT; ret = -ETIMEDOUT;
goto out_free_rx_slot; goto out_free_rx_slot;
} else {
ret = 0;
} }
if (dln2->disconnect) { if (dln2->disconnect) {
...@@ -484,10 +486,8 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd, ...@@ -484,10 +486,8 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd,
goto out_free_rx_slot; goto out_free_rx_slot;
} }
if (!ibuf) { if (!ibuf)
ret = 0;
goto out_free_rx_slot; goto out_free_rx_slot;
}
if (*ibuf_len > rsp->hdr.size - sizeof(*rsp)) if (*ibuf_len > rsp->hdr.size - sizeof(*rsp))
*ibuf_len = rsp->hdr.size - sizeof(*rsp); *ibuf_len = rsp->hdr.size - sizeof(*rsp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment