Skip to contentSkip to conversation

hpsa: fix non-x86 builds

PATCH In review Arnd Bergmann 3 participants 4 messages Jun 26, 2014 – Jul 3, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hpsa: fix non-x86 builds

commit 28e134464734 "[SCSI] hpsa: enable unit attention reporting" turns on unit attention notifications, but got the change wrong for all architectures other than x86, which now store an uninitialized value into the device register.

Gcc helpfully warns about this:

../drivers/scsi/hpsa.c: In function 'hpsa_set_driver_support_bits':
../drivers/scsi/hpsa.c:6373:17: warning: 'driver_support' is used uninitialized in this function [-Wuninitialized]

  driver_support |= ENABLE_UNIT_ATTN;
                 ^

This moves the #ifdef so only the prefetch-enable is conditional on x86, not also reading the initial register contents.

Fixes 28e134464734 "[SCSI] hpsa: enable unit attention reporting"
Cc Stephen M. Cameron <[email protected]>
Cc stable at vger.kernel.org # v3.14+
drivers/scsi/hpsa.c +2 -2
index 31184b3..d0e487c 100644
@@ -6365,9 +6365,9 @@ static inline void hpsa_set_driver_support_bits(struct ctlr_info *h)
 {
 	u32 driver_support;
 
-#ifdef CONFIG_X86
-	/* Need to enable prefetch in the SCSI core for 6400 in x86 */
 	driver_support = readl(&(h->cfgtable->driver_support));
+	/* Need to enable prefetch in the SCSI core for 6400 in x86 */
+#ifdef CONFIG_X86
 	driver_support |= ENABLE_SCSI_PREFETCH;
 #endif
 	driver_support |= ENABLE_UNIT_ATTN;
#1 lore raw
Quoted 27 lines · Arnd Bergmann

commit 28e134464734 "[SCSI] hpsa: enable unit attention reporting" turns on unit attention notifications, but got the change wrong for all architectures other than x86, which now store an uninitialized value into the device register.

Gcc helpfully warns about this:

../drivers/scsi/hpsa.c: In function 'hpsa_set_driver_support_bits':
../drivers/scsi/hpsa.c:6373:17: warning: 'driver_support' is used uninitialized in this function [-Wuninitialized]

  driver_support |= ENABLE_UNIT_ATTN;
                 ^

This moves the #ifdef so only the prefetch-enable is conditional on x86, not also reading the initial register contents.

Fixes 28e134464734 "[SCSI] hpsa: enable unit attention reporting"
Cc Stephen M. Cameron <[email protected]>
Cc stable at vger.kernel.org # v3.14+
drivers/scsi/hpsa.c +0 -0
index 31184b3..d0e487c 100644
@@ -6365,9 +6365,9 @@ static inline void hpsa_set_driver_support_bits(struct ctlr_info *h)
 {

drivers/scsi/hpsa.c static inline void hpsa_set_driver_support_bits(struct ctlr_info *h) · line 6373

Quoted 10 lines
drivers/scsi/hpsa.c +2 -2
 	u32 driver_support;
 
-#ifdef CONFIG_X86
-	/* Need to enable prefetch in the SCSI core for 6400 in x86 */
 	driver_support = readl(&(h->cfgtable->driver_support));
+	/* Need to enable prefetch in the SCSI core for 6400 in x86 */
+#ifdef CONFIG_X86
 	driver_support |= ENABLE_SCSI_PREFETCH;
 #endif
 	driver_support |= ENABLE_UNIT_ATTN;

Thanks.

-- steve

#2 lore raw
Quoted 1 line · scameron at beardog.cce.hp.com

Thanks.

Do you plan to include this with the next hpsa update, or should I take this as an ACK and apply it?

#3 lore raw
Quoted 5 lines · Christoph Hellwig
Quoted 1 line · scameron at beardog.cce.hp.com

Thanks.

Do you plan to include this with the next hpsa update, or should I take this as an ACK and apply it?

Take it as an ACK. I should have been clearer.

-- steve