From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johan Hovold Subject: Re: [PATCH 1/2] mfd: dln2: fix _dln2_transfer return code Date: Tue, 11 Nov 2014 13:23:51 +0100 Message-ID: <20141111122351.GE29789@localhost> References: <1415708457-18798-1-git-send-email-octavian.purdila@intel.com> <1415708457-18798-2-git-send-email-octavian.purdila@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1415708457-18798-2-git-send-email-octavian.purdila-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> Sender: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Octavian Purdila Cc: lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, laurentiu.palcu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org, julia.lawall-L2FTfq7BK8M@public.gmane.org, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-i2c@vger.kernel.org On Tue, Nov 11, 2014 at 02:20:56PM +0200, Octavian Purdila wrote: > 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 > --- > 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; You need braces on both branches (without commenting on the fix itself). Johan