Blame SOURCES/hdparm-9.60-ditch_dead_code.patch

e5fd4a
diff -up hdparm-9.60/sgio.c.bak hdparm-9.60/sgio.c
e5fd4a
--- hdparm-9.60/sgio.c.bak	2019-01-03 23:37:54.000000000 +0100
e5fd4a
+++ hdparm-9.60/sgio.c	2021-04-07 16:10:36.971836569 +0200
e5fd4a
@@ -17,6 +17,10 @@
e5fd4a
 
e5fd4a
 #include <linux/hdreg.h>
e5fd4a
 
e5fd4a
+#ifndef DEMAND_SENSE_DATA
e5fd4a
+	#define DEMAND_SENSE_DATA 0
e5fd4a
+#endif
e5fd4a
+
e5fd4a
 extern int verbose;
e5fd4a
 extern int prefer_ata12;
e5fd4a
 
e5fd4a
@@ -193,7 +197,7 @@ int sg16 (int fd, int rw, int dma, struc
e5fd4a
 	unsigned char cdb[SG_ATA_16_LEN];
e5fd4a
 	unsigned char sb[32], *desc;
e5fd4a
 	struct scsi_sg_io_hdr io_hdr;
e5fd4a
-	int prefer12 = prefer_ata12, demanded_sense = 0;
e5fd4a
+	int prefer12 = prefer_ata12;
e5fd4a
 
e5fd4a
 	if (tf->command == ATA_OP_PIDENTIFY)
e5fd4a
 		prefer12 = 0;
e5fd4a
@@ -306,14 +310,16 @@ int sg16 (int fd, int rw, int dma, struc
e5fd4a
 
e5fd4a
 	desc = sb + 8;
e5fd4a
 	if (io_hdr.driver_status != SG_DRIVER_SENSE) {
e5fd4a
-		if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) {
e5fd4a
-			static int second_try = 0;
e5fd4a
-			if (!second_try++)
e5fd4a
+		static int second_try = 0;
e5fd4a
+		if (!second_try++) {
e5fd4a
+			if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) {
e5fd4a
 				fprintf(stderr, "SG_IO: questionable sense data, results may be incorrect\n");
e5fd4a
-		} else if (demanded_sense) {
e5fd4a
-			static int second_try = 0;
e5fd4a
-			if (!second_try++)
e5fd4a
+			}
e5fd4a
+#if DEMAND_SENSE_DATA
e5fd4a
+			else {
e5fd4a
 				fprintf(stderr, "SG_IO: missing sense data, results may be incorrect\n");
e5fd4a
+			}
e5fd4a
+#endif
e5fd4a
 		}
e5fd4a
 	} else if (sb[0] != 0x72 || sb[7] < 14 || desc[0] != 0x09 || desc[1] < 0x0c) {
e5fd4a
 		if (verbose || tf->command != ATA_OP_IDENTIFY)