From patchwork Thu Aug 25 14:08:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 1096512 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7PE8V8D016670 for ; Thu, 25 Aug 2011 14:09:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751562Ab1HYOIv (ORCPT ); Thu, 25 Aug 2011 10:08:51 -0400 Received: from smtp-vbr1.xs4all.nl ([194.109.24.21]:2733 "EHLO smtp-vbr1.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751496Ab1HYOIr (ORCPT ); Thu, 25 Aug 2011 10:08:47 -0400 Received: from alastor.dyndns.org (215.80-203-102.nextgentel.com [80.203.102.215]) (authenticated bits=0) by smtp-vbr1.xs4all.nl (8.13.8/8.13.8) with ESMTP id p7PE8hcc043247 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 25 Aug 2011 16:08:44 +0200 (CEST) (envelope-from hverkuil@xs4all.nl) Received: from localhost.localdomain (tschai.lan [192.168.1.10]) (Authenticated sender: hans) by alastor.dyndns.org (Postfix) with ESMTPSA id 68047168C00EB; Thu, 25 Aug 2011 16:08:37 +0200 (CEST) From: Hans Verkuil To: linux-media@vger.kernel.org Cc: Hans Verkuil Subject: [RFC PATCH 03/12] wl128x: fix compiler warning + wrong write() return. Date: Thu, 25 Aug 2011 16:08:26 +0200 Message-Id: X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1314281315-32366-1-git-send-email-hverkuil@xs4all.nl> References: <1314281315-32366-1-git-send-email-hverkuil@xs4all.nl> In-Reply-To: References: X-Virus-Scanned: by XS4ALL Virus Scanner Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 25 Aug 2011 14:09:22 +0000 (UTC) From: Hans Verkuil v4l-dvb-git/drivers/media/radio/wl128x/fmdrv_v4l2.c: In function 'fm_v4l2_fops_write': v4l-dvb-git/drivers/media/radio/wl128x/fmdrv_v4l2.c:81:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable] 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 --- drivers/media/radio/wl128x/fmdrv_v4l2.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/media/radio/wl128x/fmdrv_v4l2.c b/drivers/media/radio/wl128x/fmdrv_v4l2.c index 8c0e192..478d1e9 100644 --- a/drivers/media/radio/wl128x/fmdrv_v4l2.c +++ b/drivers/media/radio/wl128x/fmdrv_v4l2.c @@ -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)