Blame SOURCES/hdparm-9.43-ditch_dead_code.patch

68dae8
Index: hdparm-9.43/sgio.c
68dae8
===================================================================
68dae8
--- hdparm-9.43.orig/sgio.c
68dae8
+++ hdparm-9.43/sgio.c
68dae8
@@ -17,6 +17,10 @@
68dae8
 
68dae8
 #include <linux/hdreg.h>
68dae8
 
68dae8
+#ifndef DEMAND_SENSE_DATA
68dae8
+	#define DEMAND_SENSE_DATA 0
68dae8
+#endif
68dae8
+
68dae8
 extern int verbose;
68dae8
 extern int prefer_ata12;
68dae8
 
68dae8
@@ -193,7 +197,7 @@ int sg16 (int fd, int rw, int dma, struc
68dae8
 	unsigned char cdb[SG_ATA_16_LEN];
68dae8
 	unsigned char sb[32], *desc;
68dae8
 	struct scsi_sg_io_hdr io_hdr;
68dae8
-	int prefer12 = prefer_ata12, demanded_sense = 0;
68dae8
+	int prefer12 = prefer_ata12;
68dae8
 
68dae8
 	if (tf->command == ATA_OP_PIDENTIFY)
68dae8
 		prefer12 = 0;
68dae8
@@ -302,14 +306,16 @@ int sg16 (int fd, int rw, int dma, struc
68dae8
 
68dae8
 	desc = sb + 8;
68dae8
 	if (io_hdr.driver_status != SG_DRIVER_SENSE) {
68dae8
-		if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) {
68dae8
-			static int second_try = 0;
68dae8
-			if (!second_try++)
68dae8
+		static int second_try = 0;
68dae8
+		if (!second_try++) {
68dae8
+			if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) {
68dae8
 				fprintf(stderr, "SG_IO: questionable sense data, results may be incorrect\n");
68dae8
-		} else if (demanded_sense) {
68dae8
-			static int second_try = 0;
68dae8
-			if (!second_try++)
68dae8
+			}
68dae8
+#if DEMAND_SENSE_DATA
68dae8
+			else {
68dae8
 				fprintf(stderr, "SG_IO: missing sense data, results may be incorrect\n");
68dae8
+			}
68dae8
+#endif
68dae8
 		}
68dae8
 	} else if (sb[0] != 0x72 || sb[7] < 14 || desc[0] != 0x09 || desc[1] < 0x0c) {
68dae8
 		dump_bytes("SG_IO: bad/missing sense data, sb[]", sb, sizeof(sb));