Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit 8536749d authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman
Browse files

staging: comedi: amplc_pc236_common: Use 16-bit 0 for interrupt data


The Amplicon PC36AT/PCI236 common driver has an "interrupt" subdevice
that supports Comedi asynchronous commands, placing a value in the
Comedi buffer for each interrupt.  The subdevice uses Comedi's 16-bit
sample format but the interrupt handler is calling
`comedi_buf_write_samples()` with the address of a 32-bit integer
`&s->state`.  On bigendian machines, this will copy 2 bytes from the
wrong end of the 32-bit integer.  This isn't really a problem since
`s->state` will always be 0 for this subdevice, but clean it up by using
a 16-bit variable initialized to 0 to pass the value.

Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20210223143055.257402-11-abbotti@mev.co.uk


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 148e34fd
Branches
Tags
No related merge requests found
...@@ -126,7 +126,9 @@ static irqreturn_t pc236_interrupt(int irq, void *d) ...@@ -126,7 +126,9 @@ static irqreturn_t pc236_interrupt(int irq, void *d)
handled = pc236_intr_check(dev); handled = pc236_intr_check(dev);
if (dev->attached && handled) { if (dev->attached && handled) {
comedi_buf_write_samples(s, &s->state, 1); unsigned short val = 0;
comedi_buf_write_samples(s, &val, 1);
comedi_handle_events(dev, s); comedi_handle_events(dev, s);
} }
return IRQ_RETVAL(handled); return IRQ_RETVAL(handled);
......
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