[8/9,3.18-stable] staging: unisys: correctly handle return value from queue_delayed_work()

Message ID 20170505115725.1424772-9-arnd@arndb.de
State New
Headers show
Series
  • fixes for all remaining known warnings
Related show

Commit Message

Arnd Bergmann May 5, 2017, 11:57 a.m.
From: Benjamin Romer <benjamin.romer@unisys.com>


Commit f84bd6267d623b49f196d54ba9edc41ff1c4d5e3 upstream

Properly handle the return value from queue_delayed_work() - it's a
bool, not an int, so using a less than comparison isn't appropriate.

This mistake was found by David Binderman <dcb314@hotmail.com>.

[arnd: the fix is from 4.4 but needed some minor fixup to adapt
 to context changes]

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
 drivers/staging/unisys/visorutil/periodic_work.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
2.9.0

Comments

Greg Kroah-Hartman May 5, 2017, 5:44 p.m. | #1
On Fri, May 05, 2017 at 01:57:24PM +0200, Arnd Bergmann wrote:
> From: Benjamin Romer <benjamin.romer@unisys.com>

> 

> Commit f84bd6267d623b49f196d54ba9edc41ff1c4d5e3 upstream

> 

> Properly handle the return value from queue_delayed_work() - it's a

> bool, not an int, so using a less than comparison isn't appropriate.

> 

> This mistake was found by David Binderman <dcb314@hotmail.com>.

> 

> [arnd: the fix is from 4.4 but needed some minor fixup to adapt

>  to context changes]


Ah, I already did this one, bug missed that there was an upstream
change.  I'll take this as well, thanks.

greg k-h

Patch

diff --git a/drivers/staging/unisys/visorutil/periodic_work.c b/drivers/staging/unisys/visorutil/periodic_work.c
index 3dd1c04d0e14..95802d0e9cc6 100644
--- a/drivers/staging/unisys/visorutil/periodic_work.c
+++ b/drivers/staging/unisys/visorutil/periodic_work.c
@@ -98,8 +98,8 @@  BOOL visor_periodic_work_nextperiod(struct periodic_work *pw)
 		pw->want_to_stop = FALSE;
 		rc = TRUE;  /* yes, TRUE; see visor_periodic_work_stop() */
 		goto unlock;
-	} else if (queue_delayed_work(pw->workqueue, &pw->work,
-				      pw->jiffy_interval) < 0) {
+	} else if (!queue_delayed_work(pw->workqueue, &pw->work,
+				       pw->jiffy_interval)) {
 		ERRDEV(pw->devnam, "queue_delayed_work failed!");
 		pw->is_scheduled = FALSE;
 		rc = FALSE;
@@ -134,8 +134,8 @@  BOOL visor_periodic_work_start(struct periodic_work *pw)
 		goto unlock;
 	}
 	INIT_DELAYED_WORK(&pw->work, &periodic_work_func);
-	if (queue_delayed_work(pw->workqueue, &pw->work,
-			       pw->jiffy_interval) < 0) {
+	if (!queue_delayed_work(pw->workqueue, &pw->work,
+				pw->jiffy_interval)) {
 		ERRDEV(pw->devnam, "%s queue_delayed_work failed!", __func__);
 		rc = FALSE;
 		goto unlock;