imm: check parport_claim
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>
Wed, 24 Feb 2016 10:57:11 +0000 (16:27 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 26 Feb 2016 02:10:53 +0000 (21:10 -0500)
parport_claim() can fail and we should be checking if we were able to
claim the port.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/imm.c

index f8b88fa78e6274f8b5956d6ea6a3f057881132f5..9164ce1249c107fd2460d0fd9b83daa6f178584b 100644 (file)
@@ -77,9 +77,10 @@ static void imm_wakeup(void *ref)
 
        spin_lock_irqsave(&arbitration_lock, flags);
        if (dev->wanted) {
-               parport_claim(dev->dev);
-               got_it(dev);
-               dev->wanted = 0;
+               if (parport_claim(dev->dev) == 0) {
+                       got_it(dev);
+                       dev->wanted = 0;
+               }
        }
        spin_unlock_irqrestore(&arbitration_lock, flags);
 }