| .. | .. |
|---|
| 109 | 109 | function, size, size, data); |
|---|
| 110 | 110 | } |
|---|
| 111 | 111 | |
|---|
| 112 | | -/** |
|---|
| 112 | +/* |
|---|
| 113 | 113 | * adu_abort_transfers |
|---|
| 114 | 114 | * aborts transfers and frees associated data structures |
|---|
| 115 | 115 | */ |
|---|
| .. | .. |
|---|
| 346 | 346 | struct adu_device *dev; |
|---|
| 347 | 347 | size_t bytes_read = 0; |
|---|
| 348 | 348 | size_t bytes_to_read = count; |
|---|
| 349 | | - int i; |
|---|
| 350 | 349 | int retval = 0; |
|---|
| 351 | 350 | int timeout = 0; |
|---|
| 352 | 351 | int should_submit = 0; |
|---|
| .. | .. |
|---|
| 374 | 373 | timeout = COMMAND_TIMEOUT; |
|---|
| 375 | 374 | dev_dbg(&dev->udev->dev, "%s : about to start looping\n", __func__); |
|---|
| 376 | 375 | while (bytes_to_read) { |
|---|
| 377 | | - int data_in_secondary = dev->secondary_tail - dev->secondary_head; |
|---|
| 376 | + size_t data_in_secondary = dev->secondary_tail - dev->secondary_head; |
|---|
| 378 | 377 | dev_dbg(&dev->udev->dev, |
|---|
| 379 | | - "%s : while, data_in_secondary=%d, status=%d\n", |
|---|
| 378 | + "%s : while, data_in_secondary=%zu, status=%d\n", |
|---|
| 380 | 379 | __func__, data_in_secondary, |
|---|
| 381 | 380 | dev->interrupt_in_urb->status); |
|---|
| 382 | 381 | |
|---|
| 383 | 382 | if (data_in_secondary) { |
|---|
| 384 | 383 | /* drain secondary buffer */ |
|---|
| 385 | | - int amount = bytes_to_read < data_in_secondary ? bytes_to_read : data_in_secondary; |
|---|
| 386 | | - i = copy_to_user(buffer, dev->read_buffer_secondary+dev->secondary_head, amount); |
|---|
| 387 | | - if (i) { |
|---|
| 384 | + size_t amount = min(bytes_to_read, data_in_secondary); |
|---|
| 385 | + if (copy_to_user(buffer, dev->read_buffer_secondary+dev->secondary_head, amount)) { |
|---|
| 388 | 386 | retval = -EFAULT; |
|---|
| 389 | 387 | goto exit; |
|---|
| 390 | 388 | } |
|---|
| 391 | | - dev->secondary_head += (amount - i); |
|---|
| 392 | | - bytes_read += (amount - i); |
|---|
| 393 | | - bytes_to_read -= (amount - i); |
|---|
| 389 | + dev->secondary_head += amount; |
|---|
| 390 | + bytes_read += amount; |
|---|
| 391 | + bytes_to_read -= amount; |
|---|
| 394 | 392 | } else { |
|---|
| 395 | 393 | /* we check the primary buffer */ |
|---|
| 396 | 394 | spin_lock_irqsave (&dev->buflock, flags); |
|---|
| .. | .. |
|---|
| 645 | 643 | .minor_base = ADU_MINOR_BASE, |
|---|
| 646 | 644 | }; |
|---|
| 647 | 645 | |
|---|
| 648 | | -/** |
|---|
| 646 | +/* |
|---|
| 649 | 647 | * adu_probe |
|---|
| 650 | 648 | * |
|---|
| 651 | 649 | * Called by the usb core when a new device is connected that it thinks |
|---|
| .. | .. |
|---|
| 756 | 754 | return retval; |
|---|
| 757 | 755 | } |
|---|
| 758 | 756 | |
|---|
| 759 | | -/** |
|---|
| 757 | +/* |
|---|
| 760 | 758 | * adu_disconnect |
|---|
| 761 | 759 | * |
|---|
| 762 | 760 | * Called by the usb core when the device is removed from the system. |
|---|