diff options
author | Octavian Purdila <octavian.purdila@intel.com> | 2014-11-18 07:57:57 -0500 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-11-19 12:12:19 -0500 |
commit | 7ca2b1c6724b150d8305ce06e4b07904ecbcb3fb (patch) | |
tree | 963bedac8667475277826c83958302c3ae6de6ef /drivers/mfd/dln2.c | |
parent | 6732127f62a7635db072294c74795a20a8996db2 (diff) |
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: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/dln2.c')
-rw-r--r-- | drivers/mfd/dln2.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c index 9765a174d2c5..cf22841c1e3c 100644 --- a/drivers/mfd/dln2.c +++ b/drivers/mfd/dln2.c | |||
@@ -462,6 +462,8 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd, | |||
462 | if (!ret) | 462 | if (!ret) |
463 | ret = -ETIMEDOUT; | 463 | ret = -ETIMEDOUT; |
464 | goto out_free_rx_slot; | 464 | goto out_free_rx_slot; |
465 | } else { | ||
466 | ret = 0; | ||
465 | } | 467 | } |
466 | 468 | ||
467 | if (dln2->disconnect) { | 469 | if (dln2->disconnect) { |
@@ -484,10 +486,8 @@ static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd, | |||
484 | goto out_free_rx_slot; | 486 | goto out_free_rx_slot; |
485 | } | 487 | } |
486 | 488 | ||
487 | if (!ibuf) { | 489 | if (!ibuf) |
488 | ret = 0; | ||
489 | goto out_free_rx_slot; | 490 | goto out_free_rx_slot; |
490 | } | ||
491 | 491 | ||
492 | if (*ibuf_len > rsp->hdr.size - sizeof(*rsp)) | 492 | if (*ibuf_len > rsp->hdr.size - sizeof(*rsp)) |
493 | *ibuf_len = rsp->hdr.size - sizeof(*rsp); | 493 | *ibuf_len = rsp->hdr.size - sizeof(*rsp); |