diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2014-05-29 11:54:25 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-06-02 03:55:02 -0400 |
commit | 67955ba36eccb5733fd289839a5a5d1dfc33ccf7 (patch) | |
tree | 08d046a9244227992325b3c73e0bfa1aa19ccdf1 | |
parent | a84d794d5c12a4c118bcdc4fecc2ca76ed02f643 (diff) |
hpsa: fix handling of hpsa_volume_offline return value
Make return value an int instead of an unsigned char so that
we do not lose negative error return values.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Webb Scales <webb.scales@hp.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | drivers/scsi/hpsa.c | 12 | ||||
-rw-r--r-- | drivers/scsi/hpsa_cmd.h | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index af51e7d4e262..31184b35370f 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -2543,11 +2543,11 @@ exit_failed: | |||
2543 | /* Determine offline status of a volume. | 2543 | /* Determine offline status of a volume. |
2544 | * Return either: | 2544 | * Return either: |
2545 | * 0 (not offline) | 2545 | * 0 (not offline) |
2546 | * -1 (offline for unknown reasons) | 2546 | * 0xff (offline for unknown reasons) |
2547 | * # (integer code indicating one of several NOT READY states | 2547 | * # (integer code indicating one of several NOT READY states |
2548 | * describing why a volume is to be kept offline) | 2548 | * describing why a volume is to be kept offline) |
2549 | */ | 2549 | */ |
2550 | static unsigned char hpsa_volume_offline(struct ctlr_info *h, | 2550 | static int hpsa_volume_offline(struct ctlr_info *h, |
2551 | unsigned char scsi3addr[]) | 2551 | unsigned char scsi3addr[]) |
2552 | { | 2552 | { |
2553 | struct CommandList *c; | 2553 | struct CommandList *c; |
@@ -2646,11 +2646,15 @@ static int hpsa_update_device_info(struct ctlr_info *h, | |||
2646 | 2646 | ||
2647 | if (this_device->devtype == TYPE_DISK && | 2647 | if (this_device->devtype == TYPE_DISK && |
2648 | is_logical_dev_addr_mode(scsi3addr)) { | 2648 | is_logical_dev_addr_mode(scsi3addr)) { |
2649 | int volume_offline; | ||
2650 | |||
2649 | hpsa_get_raid_level(h, scsi3addr, &this_device->raid_level); | 2651 | hpsa_get_raid_level(h, scsi3addr, &this_device->raid_level); |
2650 | if (h->fw_support & MISC_FW_RAID_OFFLOAD_BASIC) | 2652 | if (h->fw_support & MISC_FW_RAID_OFFLOAD_BASIC) |
2651 | hpsa_get_ioaccel_status(h, scsi3addr, this_device); | 2653 | hpsa_get_ioaccel_status(h, scsi3addr, this_device); |
2652 | this_device->volume_offline = | 2654 | volume_offline = hpsa_volume_offline(h, scsi3addr); |
2653 | hpsa_volume_offline(h, scsi3addr); | 2655 | if (volume_offline < 0 || volume_offline > 0xff) |
2656 | volume_offline = HPSA_VPD_LV_STATUS_UNSUPPORTED; | ||
2657 | this_device->volume_offline = volume_offline & 0xff; | ||
2654 | } else { | 2658 | } else { |
2655 | this_device->raid_level = RAID_UNKNOWN; | 2659 | this_device->raid_level = RAID_UNKNOWN; |
2656 | this_device->offload_config = 0; | 2660 | this_device->offload_config = 0; |
diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h index 649b463951c6..b5125dc31439 100644 --- a/drivers/scsi/hpsa_cmd.h +++ b/drivers/scsi/hpsa_cmd.h | |||
@@ -151,7 +151,7 @@ | |||
151 | #define HPSA_VPD_HEADER_SZ 4 | 151 | #define HPSA_VPD_HEADER_SZ 4 |
152 | 152 | ||
153 | /* Logical volume states */ | 153 | /* Logical volume states */ |
154 | #define HPSA_VPD_LV_STATUS_UNSUPPORTED -1 | 154 | #define HPSA_VPD_LV_STATUS_UNSUPPORTED 0xff |
155 | #define HPSA_LV_OK 0x0 | 155 | #define HPSA_LV_OK 0x0 |
156 | #define HPSA_LV_UNDERGOING_ERASE 0x0F | 156 | #define HPSA_LV_UNDERGOING_ERASE 0x0F |
157 | #define HPSA_LV_UNDERGOING_RPI 0x12 | 157 | #define HPSA_LV_UNDERGOING_RPI 0x12 |