diff mbox

hpsa: Fix type ZBC conditional checks

Message ID 1462819450.16056.2.camel@petroskoutoupis.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Petros Koutoupis May 9, 2016, 6:44 p.m. UTC
The device ID obtained from the inquiry can only be of a single type.
The original code places a check for TYPE_ZBC right after the check
for TYPE_DISK. Logically, if the first if statement sees a device of
a TYPE_DISK and moves on to the second statement checking if not
TYPE_ZBC, it will always hit the continue.

Signed-off-by: Petros Koutoupis <petros@petroskoutoupis.com>
Acked-by: Don Brace <don.brace@microsemi.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Martin K. Petersen May 11, 2016, 1:59 a.m. UTC | #1
>>>>> "Petros" == Petros Koutoupis <petros@petroskoutoupis.com> writes:

Petros> The device ID obtained from the inquiry can only be of a single
Petros> type.  The original code places a check for TYPE_ZBC right after
Petros> the check for TYPE_DISK. Logically, if the first if statement
Petros> sees a device of a TYPE_DISK and moves on to the second
Petros> statement checking if not TYPE_ZBC, it will always hit the
Petros> continue.

Did not apply to 4.7/scsi-queue. I merged it by hand.
diff mbox

Patch

--- linux/drivers/scsi/hpsa.c.orig	2016-04-27 21:43:44.463140419 -0500
+++ linux/drivers/scsi/hpsa.c	2016-04-27 22:45:31.015140419 -0500
@@ -1637,9 +1637,8 @@  static void hpsa_figure_phys_disk_ptrs(s
 		for (j = 0; j < ndevices; j++) {
 			if (dev[j] == NULL)
 				continue;
-			if (dev[j]->devtype != TYPE_DISK)
-				continue;
-			if (dev[j]->devtype != TYPE_ZBC)
+			if ((dev[j]->devtype != TYPE_DISK) &&
+			    (dev[j]->devtype != TYPE_ZBC))
 				continue;
 			if (is_logical_device(dev[j]))
 				continue;
@@ -1684,9 +1683,8 @@  static void hpsa_update_log_drive_phys_d
 	for (i = 0; i < ndevices; i++) {
 		if (dev[i] == NULL)
 			continue;
-		if (dev[i]->devtype != TYPE_DISK)
-			continue;
-		if (dev[i]->devtype != TYPE_ZBC)
+		if ((dev[i]->devtype != TYPE_DISK) &&
+		    (dev[i]->devtype != TYPE_ZBC))
 			continue;
 		if (!is_logical_device(dev[i]))
 			continue;