Skip to contentSkip to conversation

drivers: fsi: scom: Fix return code for putscom

PATCH In review Eddie James 3 participants 4 messages Feb 20, 2017 – Feb 21, 2017 FSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: fsi: scom: Fix return code for putscom

From: "Edward A. James" <[email protected]>

Read/write calls should return the number of bytes read/written on success.

---
 drivers/fsi/fsi-scom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fsi/fsi-scom.c +1 -1
index 2874ea0..51b3dc3 100644
@@ -156,7 +156,7 @@ static ssize_t scom_write(struct file *filep, const char __user *buf,
 	if (rc)
 		dev_dbg(dev, "put_scom failed with:%d\n", rc);
 
-	return rc;
+	return rc ? rc : len;
 }
 
 static loff_t scom_llseek(struct file *file, loff_t offset, int whence)
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 15 lines · Eddie James

From: "Edward A. James" <[email protected]>

Read/write calls should return the number of bytes read/written on success.

---
 drivers/fsi/fsi-scom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fsi/fsi-scom.c +0 -0
index 2874ea0..51b3dc3 100644

drivers/fsi/fsi-scom.c static ssize_t scom_write(struct file *filep, const char __user *buf, · line 159

Quoted 5 lines
drivers/fsi/fsi-scom.c +1 -1
@@ -156,7 +156,7 @@ static ssize_t scom_write(struct file *filep, const char __user *buf,
        if (rc)
                dev_dbg(dev, "put_scom failed with:%d\n", rc);
 
-       return rc;
+       return rc ? rc : len;

I refactored this to be:

 if (rc) {
     dev_dbg(dev, "put_scom failed with:%d\n", rc);
     return rc;

}

return len;

Are you ok with that?

Quoted 6 lines
drivers/fsi/fsi-scom.c +0 -1
 }
 
 static loff_t scom_llseek(struct file *file, loff_t offset, int whence)
--

1.8.3.1

#2 lore raw

Yes, looks good, thanks!

Quoted 40 lines · Joel Stanley
Quoted 15 lines · Eddie James

From: "Edward A. James" <[email protected]>

Read/write calls should return the number of bytes read/written on success.

---
 drivers/fsi/fsi-scom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fsi/fsi-scom.c +0 -0
index 2874ea0..51b3dc3 100644

drivers/fsi/fsi-scom.c static ssize_t scom_write(struct file *filep, const char __user *buf, · line 159

Quoted 5 lines
drivers/fsi/fsi-scom.c +1 -1
@@ -156,7 +156,7 @@ static ssize_t scom_write(struct file *filep, const char __user *buf,
        if (rc)
                dev_dbg(dev, "put_scom failed with:%d\n", rc);
 
-       return rc;
+       return rc ? rc : len;

I refactored this to be:

 if (rc) {
     dev_dbg(dev, "put_scom failed with:%d\n", rc);
     return rc;

}

return len;

Are you ok with that?

Quoted 6 lines
drivers/fsi/fsi-scom.c +0 -1
 }
 
 static loff_t scom_llseek(struct file *file, loff_t offset, int whence)
--

1.8.3.1

#3 lore raw
Quoted 1 line · Eddie James

Yes, looks good, thanks!

Cool, I applied it to dev-4.7.

Cheers,

Joel

Quoted 42 lines · Joel Stanley
Quoted 40 lines · Eddie James
Quoted 15 lines

From: "Edward A. James" <[email protected]>

Read/write calls should return the number of bytes read/written on success.

---
 drivers/fsi/fsi-scom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fsi/fsi-scom.c +0 -0
index 2874ea0..51b3dc3 100644

drivers/fsi/fsi-scom.c static ssize_t scom_write(struct file *filep, const char __user *buf, · line 159

Quoted 5 lines
drivers/fsi/fsi-scom.c +1 -1
@@ -156,7 +156,7 @@ static ssize_t scom_write(struct file *filep, const char __user *buf,
        if (rc)
                dev_dbg(dev, "put_scom failed with:%d\n", rc);
 
-       return rc;
+       return rc ? rc : len;

I refactored this to be:

 if (rc) {
     dev_dbg(dev, "put_scom failed with:%d\n", rc);
     return rc;

}

return len;

Are you ok with that?

Quoted 6 lines
drivers/fsi/fsi-scom.c +0 -1
 }
 
 static loff_t scom_llseek(struct file *file, loff_t offset, int whence)
--

1.8.3.1