[PATCH 2/2] PCI: switchtec: Remove useless assignments in switchtec_dev_read()

Bjorn Helgaas
2022-12-15T18:22:04Z

Some switchtec_dev_read() error cases assign to "rc", then branch to "out".
But the code at "out" never uses "rc". Drop the useless assignments. No
functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/pci/switch/switchtec.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index d7ae84070e29..c04c7ee35184 100644
--- a/drivers/pci/switch/switchtec.c
+++ b/drivers/pci/switch/switchtec.c
@@ -605,18 +605,14 @@ static ssize_t switchtec_dev_read(struct file *filp, char __user *data,

rc = copy_to_user(data, &stuser->return_code,
sizeof(stuser->return_code));
- if (rc) {
- rc = -EFAULT;
+ if (rc)
goto out;
- }

data += sizeof(stuser->return_code);
rc = copy_to_user(data, &stuser->data,
size - sizeof(stuser->return_code));
- if (rc) {
- rc = -EFAULT;
+ if (rc)
goto out;
- }

stuser_set_state(stuser, MRPC_IDLE);

--
2.25.1