Commit 197c82bf authored by Bill Pemberton's avatar Bill Pemberton Committed by Greg Kroah-Hartman

Staging: comedi: Remove instances of assignments in conditionals

Signed-off-by: default avatarBill Pemberton <wfp5p@virginia.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 6a98d36e
...@@ -882,7 +882,8 @@ static int icp_multi_attach(comedi_device *dev, comedi_devconfig *it) ...@@ -882,7 +882,8 @@ static int icp_multi_attach(comedi_device *dev, comedi_devconfig *it)
printk("icp_multi EDBG: BGN: icp_multi_attach(...)\n"); printk("icp_multi EDBG: BGN: icp_multi_attach(...)\n");
/* Alocate private data storage space */ /* Alocate private data storage space */
if ((ret = alloc_private(dev, sizeof(icp_multi_private))) < 0) ret = alloc_private(dev, sizeof(icp_multi_private));
if (ret < 0)
return ret; return ret;
/* Initialise list of PCI cards in system, if not already done so */ /* Initialise list of PCI cards in system, if not already done so */
...@@ -899,9 +900,11 @@ static int icp_multi_attach(comedi_device *dev, comedi_devconfig *it) ...@@ -899,9 +900,11 @@ static int icp_multi_attach(comedi_device *dev, comedi_devconfig *it)
printk("Anne's comedi%d: icp_multi: board=%s", dev->minor, printk("Anne's comedi%d: icp_multi: board=%s", dev->minor,
this_board->name); this_board->name);
if ((card = select_and_alloc_pci_card(PCI_VENDOR_ID_ICP, card = select_and_alloc_pci_card(PCI_VENDOR_ID_ICP,
this_board->device_id, it->options[0], this_board->device_id, it->options[0],
it->options[1])) == NULL) it->options[1]);
if (card == NULL)
return -EIO; return -EIO;
devpriv->card = card; devpriv->card = card;
...@@ -943,9 +946,9 @@ static int icp_multi_attach(comedi_device *dev, comedi_devconfig *it) ...@@ -943,9 +946,9 @@ static int icp_multi_attach(comedi_device *dev, comedi_devconfig *it)
if (this_board->n_ctrs) if (this_board->n_ctrs)
n_subdevices++; n_subdevices++;
if ((ret = alloc_subdevices(dev, n_subdevices)) < 0) { ret = alloc_subdevices(dev, n_subdevices);
if ( ret < 0 )
return ret; return ret;
}
icp_multi_reset(dev); icp_multi_reset(dev);
......
...@@ -245,8 +245,9 @@ static struct pcilst_struct *select_and_alloc_pci_card(unsigned short vendor_id, ...@@ -245,8 +245,9 @@ static struct pcilst_struct *select_and_alloc_pci_card(unsigned short vendor_id,
int err; int err;
if ((pci_bus < 1) & (pci_slot < 1)) { /* use autodetection */ if ((pci_bus < 1) & (pci_slot < 1)) { /* use autodetection */
if ((card = find_free_pci_card_by_device(vendor_id,
device_id)) == NULL) { card = find_free_pci_card_by_device(vendor_id,device_id);
if (card == NULL) {
rt_printk(" - Unused card not found in system!\n"); rt_printk(" - Unused card not found in system!\n");
return NULL; return NULL;
} }
...@@ -266,7 +267,8 @@ static struct pcilst_struct *select_and_alloc_pci_card(unsigned short vendor_id, ...@@ -266,7 +267,8 @@ static struct pcilst_struct *select_and_alloc_pci_card(unsigned short vendor_id,
} }
} }
if ((err = pci_card_alloc(card)) != 0) { err = pci_card_alloc(card);
if ( err != 0) {
if (err > 0) if (err > 0)
rt_printk(" - Can't allocate card!\n"); rt_printk(" - Can't allocate card!\n");
/* else: error already printed. */ /* else: error already printed. */
......
...@@ -779,7 +779,8 @@ static int rtd_attach(comedi_device *dev, comedi_devconfig *it) ...@@ -779,7 +779,8 @@ static int rtd_attach(comedi_device *dev, comedi_devconfig *it)
devpriv->pci_dev = pcidev; devpriv->pci_dev = pcidev;
dev->board_name = thisboard->name; dev->board_name = thisboard->name;
if ((ret = comedi_pci_enable(pcidev, DRV_NAME)) < 0) { ret = comedi_pci_enable(pcidev, DRV_NAME);
if (ret < 0) {
printk("Failed to enable PCI device and request regions.\n"); printk("Failed to enable PCI device and request regions.\n");
return ret; return ret;
} }
...@@ -918,8 +919,10 @@ static int rtd_attach(comedi_device *dev, comedi_devconfig *it) ...@@ -918,8 +919,10 @@ static int rtd_attach(comedi_device *dev, comedi_devconfig *it)
/* TODO: set user out source ??? */ /* TODO: set user out source ??? */
/* check if our interrupt is available and get it */ /* check if our interrupt is available and get it */
if ((ret = comedi_request_irq(devpriv->pci_dev->irq, rtd_interrupt, ret = comedi_request_irq(devpriv->pci_dev->irq, rtd_interrupt,
IRQF_SHARED, DRV_NAME, dev)) < 0) { IRQF_SHARED, DRV_NAME, dev);
if (ret < 0) {
printk("Could not get interrupt! (%u)\n", printk("Could not get interrupt! (%u)\n",
devpriv->pci_dev->irq); devpriv->pci_dev->irq);
return ret; return ret;
......
...@@ -525,7 +525,8 @@ static int s626_attach(comedi_device *dev, comedi_devconfig *it) ...@@ -525,7 +525,8 @@ static int s626_attach(comedi_device *dev, comedi_devconfig *it)
return -ENODEV; return -ENODEV;
} }
if ((result = comedi_pci_enable(pdev, "s626")) < 0) { result = comedi_pci_enable(pdev, "s626");
if (result < 0) {
printk("s626_attach: comedi_pci_enable fails\n"); printk("s626_attach: comedi_pci_enable fails\n");
return -ENODEV; return -ENODEV;
} }
...@@ -552,9 +553,10 @@ static int s626_attach(comedi_device *dev, comedi_devconfig *it) ...@@ -552,9 +553,10 @@ static int s626_attach(comedi_device *dev, comedi_devconfig *it)
/* adc buffer allocation */ /* adc buffer allocation */
devpriv->allocatedBuf = 0; devpriv->allocatedBuf = 0;
if ((devpriv->ANABuf.LogicalBase = devpriv->ANABuf.LogicalBase =
pci_alloc_consistent(devpriv->pdev, DMABUF_SIZE, pci_alloc_consistent(devpriv->pdev, DMABUF_SIZE, &appdma);
&appdma)) == NULL) {
if (devpriv->ANABuf.LogicalBase == NULL) {
printk("s626_attach: DMA Memory mapping error\n"); printk("s626_attach: DMA Memory mapping error\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -565,9 +567,10 @@ static int s626_attach(comedi_device *dev, comedi_devconfig *it) ...@@ -565,9 +567,10 @@ static int s626_attach(comedi_device *dev, comedi_devconfig *it)
devpriv->allocatedBuf++; devpriv->allocatedBuf++;
if ((devpriv->RPSBuf.LogicalBase = devpriv->RPSBuf.LogicalBase =
pci_alloc_consistent(devpriv->pdev, DMABUF_SIZE, pci_alloc_consistent(devpriv->pdev, DMABUF_SIZE, &appdma);
&appdma)) == NULL) {
if (devpriv->RPSBuf.LogicalBase == NULL) {
printk("s626_attach: DMA Memory mapping error\n"); printk("s626_attach: DMA Memory mapping error\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -593,8 +596,10 @@ static int s626_attach(comedi_device *dev, comedi_devconfig *it) ...@@ -593,8 +596,10 @@ static int s626_attach(comedi_device *dev, comedi_devconfig *it)
if (dev->irq == 0) { if (dev->irq == 0) {
printk(" unknown irq (bad)\n"); printk(" unknown irq (bad)\n");
} else { } else {
if ((ret = comedi_request_irq(dev->irq, s626_irq_handler, ret = comedi_request_irq(dev->irq, s626_irq_handler,
IRQF_SHARED, "s626", dev)) < 0) { IRQF_SHARED, "s626", dev);
if (ret < 0) {
printk(" irq not available\n"); printk(" irq not available\n");
dev->irq = 0; dev->irq = 0;
} }
......
...@@ -256,7 +256,8 @@ int comedi_do_insn(comedi_t *d, comedi_insn *insn) ...@@ -256,7 +256,8 @@ int comedi_do_insn(comedi_t *d, comedi_insn *insn)
/* XXX check lock */ /* XXX check lock */
if ((ret = check_chanlist(s, 1, &insn->chanspec)) < 0) { ret = check_chanlist(s, 1, &insn->chanspec);
if (ret < 0) {
rt_printk("bad chanspec\n"); rt_printk("bad chanspec\n");
ret = -EINVAL; ret = -EINVAL;
goto error; goto error;
...@@ -443,7 +444,9 @@ int comedi_cancel(comedi_t *d, unsigned int subdevice) ...@@ -443,7 +444,9 @@ int comedi_cancel(comedi_t *d, unsigned int subdevice)
if (!s->cancel || !s->async) if (!s->cancel || !s->async)
return -EINVAL; return -EINVAL;
if ((ret = s->cancel(dev, s))) ret = s->cancel(dev, s);
if (ret)
return ret; return ret;
#ifdef CONFIG_COMEDI_RT #ifdef CONFIG_COMEDI_RT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment