Blame SOURCES/hdparm-9.60-ditch_dead_code.patch

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