PCI: switchtec: Trivial cleanups
Subsystems (2)
cover PCI: switchtec: Trivial cleanups
From: Bjorn Helgaas <[email protected]>
Simplify switchtec_dma_mrpc_isr() slightly and remove some unused assignments in switchtec_dev_read().
It's possible you want a different fix for the latter, e.g., actually returning the error values that are currently assigned but then ignored.
Bjorn Helgaas (2):
PCI: switchtec: Simplify switchtec_dma_mrpc_isr()
PCI: switchtec: Remove useless assignments in switchtec_dev_read()
drivers/pci/switch/switchtec.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/2 PCI: switchtec: Simplify switchtec_dma_mrpc_isr()
From: Bjorn Helgaas <[email protected]>
The "ret" variable in switchtec_dma_mrpc_isr() is superfluous. Remove it and just return the value. No functional change intended.
--- drivers/pci/switch/switchtec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pci/switch/switchtec.c +1 -3
@@ -1480,15 +1480,13 @@ static irqreturn_t switchtec_event_isr(int irq, void *dev)static irqreturn_t switchtec_dma_mrpc_isr (int irq,void *dev) {struct switchtec_dev *stdev = dev; -irqreturn_t ret =IRQ_NONE ;iowrite32 (SWITCHTEC_EVENT_CLEAR |SWITCHTEC_EVENT_EN_IRQ , &stdev->mmio_part_cfg->mrpc_comp_hdr);schedule_work (&stdev->mrpc_work); - ret =IRQ_HANDLED ; -return ret; +return IRQ_HANDLED ; }static int switchtec_init_isr (struct switchtec_dev *stdev)
Signature · 1 line
2.25.1
PATCH 2/2 PCI: switchtec: Remove useless assignments in switchtec_dev_read()
In reply to Bjorn HelgaasFrom: Bjorn Helgaas <[email protected]>
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.
--- drivers/pci/switch/switchtec.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/pci/switch/switchtec.c +2 -6
@@ -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 );
Signature · 1 line
2.25.1
Re: [PATCH 1/2] PCI: switchtec: Simplify switchtec_dma_mrpc_isr()
In reply to Bjorn HelgaasQuoted 6 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
The "ret" variable in
switchtec_dma_mrpc_isr()is superfluous. Remove it and just return the value. No functional change intended.Signed-off-by Bjorn Helgaas <[email protected]>
Thanks,
Logan
Logan Gunthorpe
maintainerRe: [PATCH 2/2] PCI: switchtec: Remove useless assignments in switchtec_dev_read()
In reply to Bjorn HelgaasQuoted 5 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
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.
Ah, hmm, yes. I think if copy_to_user() fails, the function should probably return -EFAULT. So perhaps an unlock and specific return as is done in previous conditions in the same function?
Thanks,
Logan
Re: [PATCH 2/2] PCI: switchtec: Remove useless assignments in switchtec_dev_read()
Quoted 10 lines · Logan Gunthorpe
Quoted 5 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
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.Ah, hmm, yes. I think if
copy_to_user()fails, the function should probably return-EFAULT. So perhaps an unlock and specific return as is done in previous conditions in the same function?
Sure, I'll post a v2 that does that.