Skip to content

Commit

Permalink
mfd: dln2: Fix _dln2_transfer return code
Browse files Browse the repository at this point in the history
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: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
  • Loading branch information
Octavian Purdila authored and Lee Jones committed Nov 19, 2014
1 parent 6732127 commit 7ca2b1c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/mfd/dln2.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd,
if (!ret)
ret = -ETIMEDOUT;
goto out_free_rx_slot;
} else {
ret = 0;
}

if (dln2->disconnect) {
Expand All @@ -484,10 +486,8 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd,
goto out_free_rx_slot;
}

if (!ibuf) {
ret = 0;
if (!ibuf)
goto out_free_rx_slot;
}

if (*ibuf_len > rsp->hdr.size - sizeof(*rsp))
*ibuf_len = rsp->hdr.size - sizeof(*rsp);
Expand Down

0 comments on commit 7ca2b1c

Please sign in to comment.