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 <[email protected]>
Signed-off-by: Octavian Purdila <[email protected]>
---
 drivers/mfd/dln2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/dln2.c b/drivers/mfd/dln2.c
index 9765a17..f0747a1 100644
--- a/drivers/mfd/dln2.c
+++ b/drivers/mfd/dln2.c
@@ -462,7 +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) {
                ret = -ENODEV;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to