From patchwork Fri Apr 2 11:30:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 90352 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o32Bard8022120 for ; Fri, 2 Apr 2010 11:36:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932377Ab0DBLg1 (ORCPT ); Fri, 2 Apr 2010 07:36:27 -0400 Received: from mail-bw0-f217.google.com ([209.85.218.217]:34917 "EHLO mail-bw0-f217.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932293Ab0DBLgZ (ORCPT ); Fri, 2 Apr 2010 07:36:25 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 02 Apr 2010 11:36:55 +0000 (UTC) X-Greylist: delayed 366 seconds by postgrey-1.27 at vger.kernel.org; Fri, 02 Apr 2010 07:36:24 EDT Received: by bwz9 with SMTP id 9so1528289bwz.29 for ; Fri, 02 Apr 2010 04:36:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mail-followup-to:mime-version:content-type :content-disposition:user-agent; bh=/8UoYb9WJ5HJVu5atOqKhtucCNJeg936BMeX/yunPmM=; b=PH2Enb5CF7FpjD4GoatlXs67L2825bnIjGG7NHcU3wSparZG6OTgWsxh/RFWNFCmdM SNAJDjPaeGTkQeweQEPhhKRiwGDeg4jg9QVN+B7n4+/K6a8F4p8NBjAGNWo7PW6ykgk8 +sFa3ptje+rLd7+6gKjIUppezVFafBMLxHpBw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mail-followup-to:mime-version :content-type:content-disposition:user-agent; b=iroC9hg1qZNV/TtbHbKIDB+ZnYLVMgb9RECRvcGeRCPJPXAWma56bCiD54f0iQ+z3Z 8tEzyyR8GJLlZwDfRNT8vgPb3vzZeU96RZRuWWaTTpYWGHCvqJK5WB16D83f4O4xwmXu /kYIBypQOSus/3WG0oQa0i/ykkapY7+DH8yp0= Received: by 10.204.140.67 with SMTP id h3mr2980703bku.137.1270207817516; Fri, 02 Apr 2010 04:30:17 -0700 (PDT) Received: from bicker ([196.43.68.86]) by mx.google.com with ESMTPS id 24sm76331564bkr.12.2010.04.02.04.30.13 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 02 Apr 2010 04:30:16 -0700 (PDT) Date: Fri, 2 Apr 2010 14:30:10 +0300 From: Dan Carpenter To: Mauro Carvalho Chehab Cc: Laurent Pinchart , Hans Verkuil , Srinivasa Deevi , Trent Piepho , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] cx231xx: improve error handling Message-ID: <20100402113010.GK5265@bicker> Mail-Followup-To: Dan Carpenter , Mauro Carvalho Chehab , Laurent Pinchart , Hans Verkuil , Srinivasa Deevi , Trent Piepho , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org diff --git a/drivers/media/video/cx231xx/cx231xx-video.c b/drivers/media/video/cx231xx/cx231xx-video.c index d4f546f..5a74ef8 100644 --- a/drivers/media/video/cx231xx/cx231xx-video.c +++ b/drivers/media/video/cx231xx/cx231xx-video.c @@ -1901,9 +1901,12 @@ static int radio_queryctrl(struct file *file, void *priv, if (c->id < V4L2_CID_BASE || c->id >= V4L2_CID_LASTP1) return -EINVAL; if (c->id == V4L2_CID_AUDIO_MUTE) { - for (i = 0; i < CX231XX_CTLS; i++) + for (i = 0; i < CX231XX_CTLS; i++) { if (cx231xx_ctls[i].v.id == c->id) break; + } + if (i == CX231XX_CTLS) + return -EINVAL; *c = cx231xx_ctls[i].v; } else *c = no_ctl;