Commit 2122eaf6 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] ddbridge: fix compiler warnings

'off' was unused and 'ret' really had to be used to return -EFAULT.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 7b4668ef
...@@ -507,15 +507,14 @@ static u32 ddb_input_avail(struct ddb_input *input) ...@@ -507,15 +507,14 @@ static u32 ddb_input_avail(struct ddb_input *input)
return 0; return 0;
} }
static size_t ddb_input_read(struct ddb_input *input, u8 *buf, size_t count) static ssize_t ddb_input_read(struct ddb_input *input, u8 *buf, size_t count)
{ {
struct ddb *dev = input->port->dev; struct ddb *dev = input->port->dev;
u32 left = count; u32 left = count;
u32 idx, off, free, stat = input->stat; u32 idx, free, stat = input->stat;
int ret; int ret;
idx = (stat >> 11) & 0x1f; idx = (stat >> 11) & 0x1f;
off = (stat & 0x7ff) << 7;
while (left) { while (left) {
if (input->cbuf == idx) if (input->cbuf == idx)
...@@ -525,6 +524,8 @@ static size_t ddb_input_read(struct ddb_input *input, u8 *buf, size_t count) ...@@ -525,6 +524,8 @@ static size_t ddb_input_read(struct ddb_input *input, u8 *buf, size_t count)
free = left; free = left;
ret = copy_to_user(buf, input->vbuf[input->cbuf] + ret = copy_to_user(buf, input->vbuf[input->cbuf] +
input->coff, free); input->coff, free);
if (ret)
return -EFAULT;
input->coff += free; input->coff += free;
if (input->coff == input->dma_buf_size) { if (input->coff == input->dma_buf_size) {
input->coff = 0; input->coff = 0;
...@@ -939,6 +940,8 @@ static ssize_t ts_read(struct file *file, char *buf, ...@@ -939,6 +940,8 @@ static ssize_t ts_read(struct file *file, char *buf,
break; break;
} }
read = ddb_input_read(input, buf, left); read = ddb_input_read(input, buf, left);
if (read < 0)
return read;
left -= read; left -= read;
buf += read; buf += read;
} }
......
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