Skip to content

Commit

Permalink
[media] wl128x: fix compiler warning + wrong write() return
Browse files Browse the repository at this point in the history
The fix is to check for ret and return -EFAULT if non-zero.

I also noticed that write() didn't return the number of bytes written.
Fixed as well.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Sep 6, 2011
1 parent f68afe5 commit eb70ac1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/media/radio/wl128x/fmdrv_v4l2.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,14 @@ static ssize_t fm_v4l2_fops_write(struct file *file, const char __user * buf,
ret = copy_from_user(&rds, buf, sizeof(rds));
fmdbg("(%d)type: %d, text %s, af %d\n",
ret, rds.text_type, rds.text, rds.af_freq);
if (ret)
return -EFAULT;

fmdev = video_drvdata(file);
fm_tx_set_radio_text(fmdev, rds.text, rds.text_type);
fm_tx_set_af(fmdev, rds.af_freq);

return 0;
return sizeof(rds);
}

static u32 fm_v4l2_fops_poll(struct file *file, struct poll_table_struct *pts)
Expand Down

0 comments on commit eb70ac1

Please sign in to comment.