From 4f83d58b24b6993fc3c4bd70648c25ba5e4d5d12 Mon Sep 17 00:00:00 2001 From: Wolfgang Reissnegger Date: Sat, 23 Jul 2016 20:11:00 -0700 Subject: [PATCH] USBMSC: Fix reversed logic on waiting for SCSI thread start. The scsi thread was waiting for the wrong condition. However, this was masked by the fact that the code creating the scsi thread was also holding usbmsc_scsi_lock(priv) while initializing data, hence this lock synchronized the scsi thread start with init completion. --- drivers/usbdev/usbmsc_scsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usbdev/usbmsc_scsi.c b/drivers/usbdev/usbmsc_scsi.c index b478eb5562..d088312ca9 100644 --- a/drivers/usbdev/usbmsc_scsi.c +++ b/drivers/usbdev/usbmsc_scsi.c @@ -2641,8 +2641,8 @@ int usbmsc_scsi_main(int argc, char *argv[]) uinfo("Waiting to be signalled\n"); usbmsc_scsi_lock(priv); priv->thstate = USBMSC_STATE_STARTED; - while ((priv->theventset & USBMSC_EVENT_READY) != 0 && - (priv->theventset & USBMSC_EVENT_TERMINATEREQUEST) != 0) + while ((priv->theventset & USBMSC_EVENT_READY) == 0 && + (priv->theventset & USBMSC_EVENT_TERMINATEREQUEST) == 0) { usbmsc_scsi_wait(priv); }