LKML Archive on
help / color / mirror / Atom feed
* [PATCH] rsxx: match wait_for_completion_timeout return type
@ 2015-03-10 14:59 Nicholas Mc Guire
  0 siblings, 0 replies; only message in thread
From: Nicholas Mc Guire @ 2015-03-10 14:59 UTC (permalink / raw)
  To: Joshua Morris; +Cc: Philip Kelleher, linux-kernel, Nicholas Mc Guire

return type of wait_for_completion_timeout is unsigned long not int. An
appropriately named unsigned long is added and the
assignment fixed up.

Signed-off-by: Nicholas Mc Guire <>

Note that there does not seem to be any protection against the on stack
struct completion going out of scope if timeout occurs ! Any call to
complete() after timeout occurred would be potentially corrupting the stack
(though with high probability incorrect spin_lock magic would cause an oops).

This was only compile tested for x86_64_defconfig + CONFIG_BLK_DEV_RSXX=m

Patch is against 4.0-rc2 linux-next (localversion-next is -next-20150306)

 drivers/block/rsxx/cregs.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/block/rsxx/cregs.c b/drivers/block/rsxx/cregs.c
index 926dce9..8b9d0e3 100644
--- a/drivers/block/rsxx/cregs.c
+++ b/drivers/block/rsxx/cregs.c
@@ -392,7 +392,7 @@ static int __issue_creg_rw(struct rsxx_cardinfo *card,
 	struct creg_completion completion;
-	unsigned long timeout;
+	unsigned long timeout, time_left;
 	int st;
 	completion.cmd_done = &cmd_done;
@@ -416,8 +416,8 @@ static int __issue_creg_rw(struct rsxx_cardinfo *card,
 	 * The creg interface is guaranteed to complete. It has a timeout
 	 * mechanism that will kick in if hardware does not respond.
-	st = wait_for_completion_timeout(completion.cmd_done, timeout);
-	if (st == 0) {
+	time_left = wait_for_completion_timeout(completion.cmd_done, timeout);
+	if (!time_left) {
 		 * This is really bad, because the kernel timer did not
 		 * expire and notify us of a timeout!

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-03-10 15:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-10 14:59 [PATCH] rsxx: match wait_for_completion_timeout return type Nicholas Mc Guire

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).