pm80xx : Fixed return value issue.
Subsystems (2)
PATCH 2/2 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 <[email protected]>
--- drivers/scsi/pm8001/pm8001_ctl.c | 4 ++-- drivers/scsi/pm8001/pm8001_hwi.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/pm8001/pm8001_ctl.c +2 -2
@@ -460,7 +460,7 @@ static DEVICE_ATTR(iop_log, S_IRUGO, pm8001_ctl_iop_log_show, NULL);static ssize_t pm8001_ctl_fatal_log_show (struct device *cdev,struct device_attribute *attr,char *buf) { -u32 count; +ssize_t count; count =pm80xx_get_fatal_dump (cdev, attr, buf);return count;
@@ -478,7 +478,7 @@ static DEVICE_ATTR(fatal_log, S_IRUGO, pm8001_ctl_fatal_log_show, NULL);static ssize_t pm8001_ctl_gsm_log_show (struct device *cdev,struct device_attribute *attr,char *buf) { -u32 count; +ssize_t count; count =pm8001_get_gsm_dump (cdev,SYSFS_OFFSET , buf);return count;
drivers/scsi/pm8001/pm8001_hwi.c +4 -4
@@ -5020,7 +5020,7 @@ pm8001_get_gsm_dump(struct device *cdev, u32 length, char *buf)/* check max is 1 Mbytes */ if ((length >0x100000 ) || (gsm_dump_offset &3 ) || ((gsm_dump_offset + length) >0x1000000 )) -return 1 ; +return -EINVAL ;if (pm8001_ha->chip_id == chip_8001) bar =2 ;
@@ -5048,12 +5048,12 @@ pm8001_get_gsm_dump(struct device *cdev, u32 length, char *buf) gsm_base =GSM_BASE ;if (-1 ==pm8001_bar4_shift (pm8001_ha, (gsm_base + shift_value))) -return 1 ; +return -EIO ; }else { gsm_base =0 ;if (-1 ==pm80xx_bar4_shift (pm8001_ha, (gsm_base + shift_value))) -return 1 ; +return -EIO ; } gsm_dump_offset = (gsm_dump_offset + offset) &0xFFFF0000 ;
@@ -5073,7 +5073,7 @@ pm8001_get_gsm_dump(struct device *cdev, u32 length, char *buf) }/* Shift back to BAR4 original address */ if (-1 ==pm8001_bar4_shift (pm8001_ha,0 )) -return 1 ; +return -EIO ; pm8001_ha->fatal_forensic_shift_offset +=1024 ;if (pm8001_ha->fatal_forensic_shift_offset >=0x100000 )
Signature · 1 line
1.7.1
Quoted 2 lines · Viswas G
pm80xx_get_gsm_dump()was returning "1" in error case instead of negative error value.
Thanks for fixing this.
Acked-by Tomas Henzl <[email protected]>
-------------------
It think that the return value in pm80xx_get_fatal_dump should also be fixed, please consider it.
(not even compile tested)
Tomas
---
drivers/scsi/pm8001/pm80xx_hwi.c +1 -6
@@ -91,7 +91,6 @@ ssize_t pm80xx_get_fatal_dump(struct device *cdev,struct sas_ha_struct *sha =SHOST_TO_SAS_HA (shost);struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;void __iomem *fatal_table_address = pm8001_ha->fatal_tbl_addr; -u32 status =1 ;u32 accum_len , reg_val, index, *temp;unsigned long start;u8 *direct_data;
@@ -135,7 +134,7 @@ ssize_t pm80xx_get_fatal_dump(struct device *cdev,PM8001_IO_DBG (pm8001_ha,pm8001_printk ("Possible PCI issue 0x%x not expected\n" , accum_len)); -return status; +return -EIO ; }if (accum_len ==0 || accum_len >=0x100000 ) { pm8001_ha->forensic_info.data_buf.direct_data +=
@@ -178,7 +177,6 @@ moreData: pm8001_ha->forensic_fatal_step =1 ; pm8001_ha->fatal_forensic_shift_offset =0 ; pm8001_ha->forensic_last_offset =0 ; - status =0 ;return (char *)pm8001_ha-> forensic_info.data_buf.direct_data - (char *)buf;
@@ -194,7 +192,6 @@ moreData: forensic_info.data_buf.direct_data, "%08x ", *(temp + index)); } - status =0 ;return (char *)pm8001_ha-> forensic_info.data_buf.direct_data - (char *)buf;
@@ -214,7 +211,6 @@ moreData:pm8001_cw32 (pm8001_ha,0 ,MEMBASE_II_SHIFT_REGISTER , pm8001_ha->fatal_forensic_shift_offset); pm8001_ha->fatal_bar_loc =0 ; - status =0 ;return (char *)pm8001_ha->forensic_info.data_buf.direct_data - (char *)buf; }
@@ -259,7 +255,6 @@ moreData: pm8001_ha->forensic_info.data_buf.direct_len =0 ; pm8001_ha->forensic_info.data_buf.direct_offset =0 ; pm8001_ha->forensic_info.data_buf.read_len =0 ; - status =0 ; } }