diff options
author | Viswas G <Viswas.G@pmcs.com> | 2013-12-10 00:01:38 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2014-03-15 13:17:47 -0400 |
commit | cf370066ac5c7d5fdf384fef24b8ba48a481ffa5 (patch) | |
tree | a34a2eb9ac4bf4e3c6326c4bc5dfb2e08e8d2df1 /drivers/scsi/pm8001 | |
parent | 859b5d103539ece7d3219f64ce09c6bf5de124e9 (diff) |
[SCSI] pm80xx: Fixed return value issue
pm80xx_get_gsm_dump() was returning "1" in error case
instead of negative error value.
Signed-off-by: Viswas G <Viswas.G@pmcs.com>
Reviewed-by: Jack Wang <jinpu.wang@profitbricks.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/pm8001')
-rw-r--r-- | drivers/scsi/pm8001/pm8001_ctl.c | 4 | ||||
-rw-r--r-- | drivers/scsi/pm8001/pm8001_hwi.c | 8 | ||||
-rw-r--r-- | drivers/scsi/pm8001/pm80xx_hwi.c | 13 |
3 files changed, 9 insertions, 16 deletions
diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c index 173896583121..28b4e8139153 100644 --- a/drivers/scsi/pm8001/pm8001_ctl.c +++ b/drivers/scsi/pm8001/pm8001_ctl.c | |||
@@ -452,7 +452,7 @@ static DEVICE_ATTR(iop_log, S_IRUGO, pm8001_ctl_iop_log_show, NULL); | |||
452 | static ssize_t pm8001_ctl_fatal_log_show(struct device *cdev, | 452 | static ssize_t pm8001_ctl_fatal_log_show(struct device *cdev, |
453 | struct device_attribute *attr, char *buf) | 453 | struct device_attribute *attr, char *buf) |
454 | { | 454 | { |
455 | u32 count; | 455 | ssize_t count; |
456 | 456 | ||
457 | count = pm80xx_get_fatal_dump(cdev, attr, buf); | 457 | count = pm80xx_get_fatal_dump(cdev, attr, buf); |
458 | return count; | 458 | return count; |
@@ -470,7 +470,7 @@ static DEVICE_ATTR(fatal_log, S_IRUGO, pm8001_ctl_fatal_log_show, NULL); | |||
470 | static ssize_t pm8001_ctl_gsm_log_show(struct device *cdev, | 470 | static ssize_t pm8001_ctl_gsm_log_show(struct device *cdev, |
471 | struct device_attribute *attr, char *buf) | 471 | struct device_attribute *attr, char *buf) |
472 | { | 472 | { |
473 | u32 count; | 473 | ssize_t count; |
474 | 474 | ||
475 | count = pm8001_get_gsm_dump(cdev, SYSFS_OFFSET, buf); | 475 | count = pm8001_get_gsm_dump(cdev, SYSFS_OFFSET, buf); |
476 | return count; | 476 | return count; |
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index 2aa068112bda..46ace52eeb2d 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c | |||
@@ -5020,7 +5020,7 @@ pm8001_get_gsm_dump(struct device *cdev, u32 length, char *buf) | |||
5020 | /* check max is 1 Mbytes */ | 5020 | /* check max is 1 Mbytes */ |
5021 | if ((length > 0x100000) || (gsm_dump_offset & 3) || | 5021 | if ((length > 0x100000) || (gsm_dump_offset & 3) || |
5022 | ((gsm_dump_offset + length) > 0x1000000)) | 5022 | ((gsm_dump_offset + length) > 0x1000000)) |
5023 | return 1; | 5023 | return -EINVAL; |
5024 | 5024 | ||
5025 | if (pm8001_ha->chip_id == chip_8001) | 5025 | if (pm8001_ha->chip_id == chip_8001) |
5026 | bar = 2; | 5026 | bar = 2; |
@@ -5048,12 +5048,12 @@ pm8001_get_gsm_dump(struct device *cdev, u32 length, char *buf) | |||
5048 | gsm_base = GSM_BASE; | 5048 | gsm_base = GSM_BASE; |
5049 | if (-1 == pm8001_bar4_shift(pm8001_ha, | 5049 | if (-1 == pm8001_bar4_shift(pm8001_ha, |
5050 | (gsm_base + shift_value))) | 5050 | (gsm_base + shift_value))) |
5051 | return 1; | 5051 | return -EIO; |
5052 | } else { | 5052 | } else { |
5053 | gsm_base = 0; | 5053 | gsm_base = 0; |
5054 | if (-1 == pm80xx_bar4_shift(pm8001_ha, | 5054 | if (-1 == pm80xx_bar4_shift(pm8001_ha, |
5055 | (gsm_base + shift_value))) | 5055 | (gsm_base + shift_value))) |
5056 | return 1; | 5056 | return -EIO; |
5057 | } | 5057 | } |
5058 | gsm_dump_offset = (gsm_dump_offset + offset) & | 5058 | gsm_dump_offset = (gsm_dump_offset + offset) & |
5059 | 0xFFFF0000; | 5059 | 0xFFFF0000; |
@@ -5073,7 +5073,7 @@ pm8001_get_gsm_dump(struct device *cdev, u32 length, char *buf) | |||
5073 | } | 5073 | } |
5074 | /* Shift back to BAR4 original address */ | 5074 | /* Shift back to BAR4 original address */ |
5075 | if (-1 == pm8001_bar4_shift(pm8001_ha, 0)) | 5075 | if (-1 == pm8001_bar4_shift(pm8001_ha, 0)) |
5076 | return 1; | 5076 | return -EIO; |
5077 | pm8001_ha->fatal_forensic_shift_offset += 1024; | 5077 | pm8001_ha->fatal_forensic_shift_offset += 1024; |
5078 | 5078 | ||
5079 | if (pm8001_ha->fatal_forensic_shift_offset >= 0x100000) | 5079 | if (pm8001_ha->fatal_forensic_shift_offset >= 0x100000) |
diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index c950dc5c9943..9b5414249cc4 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c | |||
@@ -91,7 +91,6 @@ ssize_t pm80xx_get_fatal_dump(struct device *cdev, | |||
91 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); | 91 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); |
92 | struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; | 92 | struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; |
93 | void __iomem *fatal_table_address = pm8001_ha->fatal_tbl_addr; | 93 | void __iomem *fatal_table_address = pm8001_ha->fatal_tbl_addr; |
94 | u32 status = 1; | ||
95 | u32 accum_len , reg_val, index, *temp; | 94 | u32 accum_len , reg_val, index, *temp; |
96 | unsigned long start; | 95 | unsigned long start; |
97 | u8 *direct_data; | 96 | u8 *direct_data; |
@@ -111,13 +110,10 @@ ssize_t pm80xx_get_fatal_dump(struct device *cdev, | |||
111 | direct_data = (u8 *)fatal_error_data; | 110 | direct_data = (u8 *)fatal_error_data; |
112 | pm8001_ha->forensic_info.data_type = TYPE_NON_FATAL; | 111 | pm8001_ha->forensic_info.data_type = TYPE_NON_FATAL; |
113 | pm8001_ha->forensic_info.data_buf.direct_len = SYSFS_OFFSET; | 112 | pm8001_ha->forensic_info.data_buf.direct_len = SYSFS_OFFSET; |
114 | pm8001_ha->forensic_info.data_buf.direct_offset = 0; | ||
115 | pm8001_ha->forensic_info.data_buf.read_len = 0; | 113 | pm8001_ha->forensic_info.data_buf.read_len = 0; |
116 | 114 | ||
117 | pm8001_ha->forensic_info.data_buf.direct_data = direct_data; | 115 | pm8001_ha->forensic_info.data_buf.direct_data = direct_data; |
118 | } | ||
119 | 116 | ||
120 | if (pm8001_ha->forensic_info.data_buf.direct_offset == 0) { | ||
121 | /* start to get data */ | 117 | /* start to get data */ |
122 | /* Program the MEMBASE II Shifting Register with 0x00.*/ | 118 | /* Program the MEMBASE II Shifting Register with 0x00.*/ |
123 | pm8001_cw32(pm8001_ha, 0, MEMBASE_II_SHIFT_REGISTER, | 119 | pm8001_cw32(pm8001_ha, 0, MEMBASE_II_SHIFT_REGISTER, |
@@ -126,6 +122,7 @@ ssize_t pm80xx_get_fatal_dump(struct device *cdev, | |||
126 | pm8001_ha->forensic_fatal_step = 0; | 122 | pm8001_ha->forensic_fatal_step = 0; |
127 | pm8001_ha->fatal_bar_loc = 0; | 123 | pm8001_ha->fatal_bar_loc = 0; |
128 | } | 124 | } |
125 | |||
129 | /* Read until accum_len is retrived */ | 126 | /* Read until accum_len is retrived */ |
130 | accum_len = pm8001_mr32(fatal_table_address, | 127 | accum_len = pm8001_mr32(fatal_table_address, |
131 | MPI_FATAL_EDUMP_TABLE_ACCUM_LEN); | 128 | MPI_FATAL_EDUMP_TABLE_ACCUM_LEN); |
@@ -135,7 +132,7 @@ ssize_t pm80xx_get_fatal_dump(struct device *cdev, | |||
135 | PM8001_IO_DBG(pm8001_ha, | 132 | PM8001_IO_DBG(pm8001_ha, |
136 | pm8001_printk("Possible PCI issue 0x%x not expected\n", | 133 | pm8001_printk("Possible PCI issue 0x%x not expected\n", |
137 | accum_len)); | 134 | accum_len)); |
138 | return status; | 135 | return -EIO; |
139 | } | 136 | } |
140 | if (accum_len == 0 || accum_len >= 0x100000) { | 137 | if (accum_len == 0 || accum_len >= 0x100000) { |
141 | pm8001_ha->forensic_info.data_buf.direct_data += | 138 | pm8001_ha->forensic_info.data_buf.direct_data += |
@@ -178,7 +175,6 @@ moreData: | |||
178 | pm8001_ha->forensic_fatal_step = 1; | 175 | pm8001_ha->forensic_fatal_step = 1; |
179 | pm8001_ha->fatal_forensic_shift_offset = 0; | 176 | pm8001_ha->fatal_forensic_shift_offset = 0; |
180 | pm8001_ha->forensic_last_offset = 0; | 177 | pm8001_ha->forensic_last_offset = 0; |
181 | status = 0; | ||
182 | return (char *)pm8001_ha-> | 178 | return (char *)pm8001_ha-> |
183 | forensic_info.data_buf.direct_data - | 179 | forensic_info.data_buf.direct_data - |
184 | (char *)buf; | 180 | (char *)buf; |
@@ -194,7 +190,6 @@ moreData: | |||
194 | forensic_info.data_buf.direct_data, | 190 | forensic_info.data_buf.direct_data, |
195 | "%08x ", *(temp + index)); | 191 | "%08x ", *(temp + index)); |
196 | } | 192 | } |
197 | status = 0; | ||
198 | return (char *)pm8001_ha-> | 193 | return (char *)pm8001_ha-> |
199 | forensic_info.data_buf.direct_data - | 194 | forensic_info.data_buf.direct_data - |
200 | (char *)buf; | 195 | (char *)buf; |
@@ -214,7 +209,6 @@ moreData: | |||
214 | pm8001_cw32(pm8001_ha, 0, MEMBASE_II_SHIFT_REGISTER, | 209 | pm8001_cw32(pm8001_ha, 0, MEMBASE_II_SHIFT_REGISTER, |
215 | pm8001_ha->fatal_forensic_shift_offset); | 210 | pm8001_ha->fatal_forensic_shift_offset); |
216 | pm8001_ha->fatal_bar_loc = 0; | 211 | pm8001_ha->fatal_bar_loc = 0; |
217 | status = 0; | ||
218 | return (char *)pm8001_ha->forensic_info.data_buf.direct_data - | 212 | return (char *)pm8001_ha->forensic_info.data_buf.direct_data - |
219 | (char *)buf; | 213 | (char *)buf; |
220 | } | 214 | } |
@@ -239,7 +233,7 @@ moreData: | |||
239 | PM8001_FAIL_DBG(pm8001_ha, | 233 | PM8001_FAIL_DBG(pm8001_ha, |
240 | pm8001_printk("TIMEOUT:MEMBASE_II_SHIFT_REGISTER" | 234 | pm8001_printk("TIMEOUT:MEMBASE_II_SHIFT_REGISTER" |
241 | " = 0x%x\n", reg_val)); | 235 | " = 0x%x\n", reg_val)); |
242 | return -1; | 236 | return -EIO; |
243 | } | 237 | } |
244 | 238 | ||
245 | /* Read the next 64K of the debug data. */ | 239 | /* Read the next 64K of the debug data. */ |
@@ -259,7 +253,6 @@ moreData: | |||
259 | pm8001_ha->forensic_info.data_buf.direct_len = 0; | 253 | pm8001_ha->forensic_info.data_buf.direct_len = 0; |
260 | pm8001_ha->forensic_info.data_buf.direct_offset = 0; | 254 | pm8001_ha->forensic_info.data_buf.direct_offset = 0; |
261 | pm8001_ha->forensic_info.data_buf.read_len = 0; | 255 | pm8001_ha->forensic_info.data_buf.read_len = 0; |
262 | status = 0; | ||
263 | } | 256 | } |
264 | } | 257 | } |
265 | 258 | ||