From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicholas Mc Guire Subject: [PATCH v2] i2c: designware: fixup return handling of wait_for_completion_timeout Date: Tue, 10 Feb 2015 03:11:14 -0500 Message-ID: <1423555874-19650-1-git-send-email-hofrat@osadl.org> Return-path: Sender: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Wolfram Sang Cc: Mika Westerberg , Jisheng Zhang , Du Wenkai , Shinya Kuribayashi , Romain Baeriswyl , Jarkko Nikula , Andrew Jackson , David Box , linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Nicholas Mc Guire List-Id: linux-i2c@vger.kernel.org return type of wait_for_completion_timeout is unsigned long not int, rather than introducing a new variable the wait_for_completion_timeout is moved into the if condition as the return value is only used to detect timeout. Signed-off-by: Nicholas Mc Guire --- v2: Aside from the newly added variable having the wrong type (...) the preferred solution is to simply wrap wait_for_completion_timeout into the condition as the remaining jiffies is actually not used - suggested be Jarkko Nikula cmd_complete, HZ); - if (ret == 0) { + if (!wait_for_completion_timeout(&dev->cmd_complete, HZ)) { dev_err(dev->dev, "controller timed out\n"); /* i2c_dw_init implicitly disables the adapter */ i2c_dw_init(dev); -- 1.7.10.4