scsi: scsi_dh_alua: Warn if the first argument of alua_rtpg_queue() is NULL
authorBart Van Assche <bart.vanassche@sandisk.com>
Sat, 18 Mar 2017 00:02:03 +0000 (17:02 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sun, 19 Mar 2017 17:16:37 +0000 (13:16 -0400)
Callers must provide a valid port group to alua_rtpg_queue().  Issue a
kernel warning if that is not the case.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Tang Junhui <tang.junhui@zte.com.cn>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/device_handler/scsi_dh_alua.c

index b6849d3ecefecb9a95613487729ab3f9d262d2eb..c01b47e5b55a899a48b28553a41747b04d2903cc 100644 (file)
@@ -876,7 +876,7 @@ static bool alua_rtpg_queue(struct alua_port_group *pg,
        unsigned long flags;
        struct workqueue_struct *alua_wq = kaluad_wq;
 
-       if (!pg || scsi_device_get(sdev))
+       if (WARN_ON_ONCE(!pg) || scsi_device_get(sdev))
                return false;
 
        spin_lock_irqsave(&pg->lock, flags);