From 7ca2b1c6724b150d8305ce06e4b07904ecbcb3fb Mon Sep 17 00:00:00 2001 From: Octavian Purdila Date: Tue, 18 Nov 2014 14:57:57 +0200 Subject: [PATCH] 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 Signed-off-by: Octavian Purdila Signed-off-by: Lee Jones --- drivers/mfd/dln2.c | 6 +++--- 1 file 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, if (!ret) ret = -ETIMEDOUT; goto out_free_rx_slot; + } else { + ret = 0; } if (dln2->disconnect) { @@ -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); -- 2.20.1