Skip to content

Commit

Permalink
usb: misc: adutux: use swap()
Browse files Browse the repository at this point in the history
Use swap() in order to make code cleaner. Issue found by coccinelle.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
Link: https://lore.kernel.org/r/20210803005343.GA1578854@pc
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Salah Triki authored and Greg Kroah-Hartman committed Aug 5, 2021
1 parent 90059e9 commit e21dd90
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/usb/misc/adutux.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,10 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
spin_lock_irqsave (&dev->buflock, flags);
if (dev->read_buffer_length) {
/* we secure access to the primary */
char *tmp;
dev_dbg(&dev->udev->dev,
"%s : swap, read_buffer_length = %d\n",
__func__, dev->read_buffer_length);
tmp = dev->read_buffer_secondary;
dev->read_buffer_secondary = dev->read_buffer_primary;
dev->read_buffer_primary = tmp;
swap(dev->read_buffer_primary, dev->read_buffer_secondary);
dev->secondary_head = 0;
dev->secondary_tail = dev->read_buffer_length;
dev->read_buffer_length = 0;
Expand Down

0 comments on commit e21dd90

Please sign in to comment.