Skip to content

Commit 0784d32

Browse files
committed
Merge branch 'pci/controller/switchtec'
- Return -EFAULT instead of unrelated codes for copy_to_user() errors (Bjorn Helgaas) * pci/controller/switchtec: PCI: switchtec: Return -EFAULT for copy_to_user() errors PCI: switchtec: Simplify switchtec_dma_mrpc_isr()
2 parents b237474 + ddc1093 commit 0784d32

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

drivers/pci/switch/switchtec.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -606,21 +606,20 @@ static ssize_t switchtec_dev_read(struct file *filp, char __user *data,
606606
rc = copy_to_user(data, &stuser->return_code,
607607
sizeof(stuser->return_code));
608608
if (rc) {
609-
rc = -EFAULT;
610-
goto out;
609+
mutex_unlock(&stdev->mrpc_mutex);
610+
return -EFAULT;
611611
}
612612

613613
data += sizeof(stuser->return_code);
614614
rc = copy_to_user(data, &stuser->data,
615615
size - sizeof(stuser->return_code));
616616
if (rc) {
617-
rc = -EFAULT;
618-
goto out;
617+
mutex_unlock(&stdev->mrpc_mutex);
618+
return -EFAULT;
619619
}
620620

621621
stuser_set_state(stuser, MRPC_IDLE);
622622

623-
out:
624623
mutex_unlock(&stdev->mrpc_mutex);
625624

626625
if (stuser->status == SWITCHTEC_MRPC_STATUS_DONE ||
@@ -1480,15 +1479,13 @@ static irqreturn_t switchtec_event_isr(int irq, void *dev)
14801479
static irqreturn_t switchtec_dma_mrpc_isr(int irq, void *dev)
14811480
{
14821481
struct switchtec_dev *stdev = dev;
1483-
irqreturn_t ret = IRQ_NONE;
14841482

14851483
iowrite32(SWITCHTEC_EVENT_CLEAR |
14861484
SWITCHTEC_EVENT_EN_IRQ,
14871485
&stdev->mmio_part_cfg->mrpc_comp_hdr);
14881486
schedule_work(&stdev->mrpc_work);
14891487

1490-
ret = IRQ_HANDLED;
1491-
return ret;
1488+
return IRQ_HANDLED;
14921489
}
14931490

14941491
static int switchtec_init_isr(struct switchtec_dev *stdev)

0 commit comments

Comments
 (0)