Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 281356
b: refs/heads/master
c: 8fe6495
h: refs/heads/master
v: v3
  • Loading branch information
Lars-Peter Clausen authored and Greg Kroah-Hartman committed Dec 13, 2011
1 parent 6a50304 commit c87de56
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 641b4bb5f1c51a68f5aec7d3b47c96b39820b105
refs/heads/master: 8fe64955e47277abf4a3ec56383ea9b9487bd029
2 changes: 1 addition & 1 deletion trunk/drivers/staging/iio/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct iio_buffer;
* @mark_in_use: reference counting, typically to prevent module removal
* @unmark_in_use: reduce reference count when no longer using buffer
* @store_to: actually store stuff to the buffer
* @read_first_n: try to get a specified number of elements (must exist)
* @read_first_n: try to get a specified number of bytes (must exist)
* @mark_param_change: notify buffer that some relevant parameter has changed
* Often this means the underlying storage may need to
* change.
Expand Down
6 changes: 5 additions & 1 deletion trunk/drivers/staging/iio/kfifo_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@ static int iio_read_first_n_kfifo(struct iio_buffer *r,
int ret, copied;
struct iio_kfifo *kf = iio_to_kfifo(r);

ret = kfifo_to_user(&kf->kf, buf, r->bytes_per_datum*n, &copied);
if (n < r->bytes_per_datum)
return -EINVAL;

n = rounddown(n, r->bytes_per_datum);
ret = kfifo_to_user(&kf->kf, buf, n, &copied);

return copied;
}
Expand Down

0 comments on commit c87de56

Please sign in to comment.