Skip to contentSkip to conversation

pm80xx : Fixed return value issue

PATCH In review Viswas G 4 participants 6 messages Nov 20, 2013 – Nov 21, 2013

Subsystems (2)
lore
Share & tools
lore

Viswas G

author
#0 lore raw

PATCH 6/6 pm80xx : Fixed return value issue

pm8001_get_gsm_dump() was returning "1" in error case instead of negative error code.

---
 drivers/scsi/pm8001/pm8001_hwi.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +4 -4
index f6ea277..e2932ef 100644
@@ -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 -EINVAL;
 			} else {
 				gsm_base = 0;
 				if (-1 == pm80xx_bar4_shift(pm8001_ha,
 						(gsm_base + shift_value)))
-					return 1;
+					return -EINVAL;
 			}
 			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 -EINVAL;
 	pm8001_ha->fatal_forensic_shift_offset += 1024;
 
 	if (pm8001_ha->fatal_forensic_shift_offset >= 0x100000)
Signature · 1 line
1.7.1
Reviewed-by on v1 6/6
#1 lore raw
Quoted 4 lines · Viswas G

pm8001_get_gsm_dump() was returning "1" in error case instead of negative error code.

Looks good, thanks

Quoted 42 lines
---
 drivers/scsi/pm8001/pm8001_hwi.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +4 -4
index f6ea277..e2932ef 100644
@@ -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 -EINVAL;
 			} else {
 				gsm_base = 0;
 				if (-1 == pm80xx_bar4_shift(pm8001_ha,
 						(gsm_base + shift_value)))
-					return 1;
+					return -EINVAL;
 			}
 			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 -EINVAL;
 	pm8001_ha->fatal_forensic_shift_offset += 1024;
 
 	if (pm8001_ha->fatal_forensic_shift_offset >= 0x100000)
#2 lore raw
In reply to Viswas G
Quoted 2 lines · Viswas G

pm8001_get_gsm_dump() was returning "1" in error case instead of negative error code.

Hi,

the pm8001_get_gsm_dum return value is used here I think:
----------------
static ssize_t pm8001_ctl_gsm_log_show(struct device *cdev,
struct device_attribute *attr, char *buf)

{
       u32 count;

       count = pm8001_get_gsm_dump(cdev, SYSFS_OFFSET, buf);

---------------
could you also change the 'count' from unsigned to a signed type?

Maybe in some cases another errno would make more sense (ENODEV, EIO?), but I'll leave this up to you.

I have noticed in this series only patches 5/6 and 6/6, I miss the 1-4/6, could you help me find them ? What are the subjects of 1-4/6?

Thanks, Tomas

Quoted 43 lines
---
 drivers/scsi/pm8001/pm8001_hwi.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +4 -4
index f6ea277..e2932ef 100644
@@ -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 -EINVAL;
 			} else {
 				gsm_base = 0;
 				if (-1 == pm80xx_bar4_shift(pm8001_ha,
 						(gsm_base + shift_value)))
-					return 1;
+					return -EINVAL;
 			}
 			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 -EINVAL;
 	pm8001_ha->fatal_forensic_shift_offset += 1024;
 
 	if (pm8001_ha->fatal_forensic_shift_offset >= 0x100000)
author
#3 lore raw

Hi Tomas,

Patches 1-4 are submitted with subject "[PATCH V2 0/4]: pm8001 driver bug fixes".

As this patch has to be applied after those four patches, we submitted this as 5/6 and 6/6.

We will resend the modified patch.

Regards,
Viswas G

-----Original Message-----
From: Tomas Henzl [mailto:[email protected]]
Sent: Wednesday, November 20, 2013 10:16 PM
To: Viswas G; [email protected]
Cc: [email protected]; Vasanthalakshmi Tharmarajan; Suresh Thiagarajan
Subject: Re: [PATCH 6/6] pm80xx : Fixed return value issue

Quoted 2 lines · Viswas G

pm8001_get_gsm_dump() was returning "1" in error case instead of negative error code.

Hi,

the pm8001_get_gsm_dum return value is used here I think:
----------------
static ssize_t pm8001_ctl_gsm_log_show(struct device *cdev,

       struct device_attribute *attr, char *buf) {
       u32 count;

       count = pm8001_get_gsm_dump(cdev, SYSFS_OFFSET, buf);

---------------
could you also change the 'count' from unsigned to a signed type?

Maybe in some cases another errno would make more sense (ENODEV, EIO?), but I'll leave this up to you.

I have noticed in this series only patches 5/6 and 6/6, I miss the 1-4/6, could you help me find them ? What are the subjects of 1-4/6?

Thanks, Tomas

Quoted 44 lines
---
 drivers/scsi/pm8001/pm8001_hwi.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +4 -4
index f6ea277..e2932ef 100644
@@ -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 -EINVAL;
 			} else {
 				gsm_base = 0;
 				if (-1 == pm80xx_bar4_shift(pm8001_ha,
 						(gsm_base + shift_value)))
-					return 1;
+					return -EINVAL;
 			}
 			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 -EINVAL;
 	pm8001_ha->fatal_forensic_shift_offset += 1024;
 
 	if (pm8001_ha->fatal_forensic_shift_offset >= 0x100000)
#4 lore raw
Quoted 5 lines · Viswas G

Hi Tomas,

Patches 1-4 are submitted with subject "[PATCH V2 0/4]: pm8001 driver bug fixes".

As this patch has to be applied after those four patches, we submitted this as 5/6 and 6/6.

I was confused because the series 1-4/4 was send by another person, thanks for clarification.

Quoted 82 lines

We will resend the modified patch.

Regards,
Viswas G

-----Original Message-----
From: Tomas Henzl [mailto:[email protected]]
Sent: Wednesday, November 20, 2013 10:16 PM
To: Viswas G; [email protected]
Cc: [email protected]; Vasanthalakshmi Tharmarajan; Suresh Thiagarajan
Subject: Re: [PATCH 6/6] pm80xx : Fixed return value issue

Quoted 2 lines · Viswas G

pm8001_get_gsm_dump() was returning "1" in error case instead of negative error code.

Hi,

the pm8001_get_gsm_dum return value is used here I think:
----------------
static ssize_t pm8001_ctl_gsm_log_show(struct device *cdev,

       struct device_attribute *attr, char *buf) {
       u32 count;

       count = pm8001_get_gsm_dump(cdev, SYSFS_OFFSET, buf);

---------------
could you also change the 'count' from unsigned to a signed type?

Maybe in some cases another errno would make more sense (ENODEV, EIO?), but I'll leave this up to you.

I have noticed in this series only patches 5/6 and 6/6, I miss the 1-4/6, could you help me find them ? What are the subjects of 1-4/6?

Thanks, Tomas

Quoted 35 lines
---
 drivers/scsi/pm8001/pm8001_hwi.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +3 -3
index f6ea277..e2932ef 100644
@@ -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 -EINVAL;
 			} else {
 				gsm_base = 0;
 				if (-1 == pm80xx_bar4_shift(pm8001_ha,
 						(gsm_base + shift_value)))
-					return 1;
+					return -EINVAL;
 			}
 			gsm_dump_offset = (gsm_dump_offset + offset) &
 						0xFFFF0000;

drivers/scsi/pm8001/pm8001_hwi.c pm8001_get_gsm_dump(struct device *cdev, u32 length, char* buf) · line 5079

Quoted 8 lines
drivers/scsi/pm8001/pm8001_hwi.c +1 -1
@@ -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 -EINVAL;
 	pm8001_ha->fatal_forensic_shift_offset += 1024;
 
 	if (pm8001_ha->fatal_forensic_shift_offset >= 0x100000)

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#5 lore raw
Quoted 8 lines · Tomas Henzl
Quoted 5 lines · Viswas G

Hi Tomas,

Patches 1-4 are submitted with subject "[PATCH V2 0/4]: pm8001 driver bug fixes".

As this patch has to be applied after those four patches, we submitted this as 5/6 and 6/6.

I was confused because the series 1-4/4 was send by another person,

And it was labelled 1-4/4 so it's not really natural to think of 5 and 6 following on ... you weren't the only one confused.

James

Quoted 1 line

thanks for clarification.