From patchwork Fri Apr 2 11:31:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 90353 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 o32Bd5Iu022696 for ; Fri, 2 Apr 2010 11:39:05 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932385Ab0DBLix (ORCPT ); Fri, 2 Apr 2010 07:38:53 -0400 Received: from mail-bw0-f217.google.com ([209.85.218.217]:39349 "EHLO mail-bw0-f217.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932371Ab0DBLiw (ORCPT ); Fri, 2 Apr 2010 07:38:52 -0400 Received: by bwz9 with SMTP id 9so1529763bwz.29 for ; Fri, 02 Apr 2010 04:38:50 -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=bqYAPwAi1ytOENx7pHneBSmXpgGxa0kSbz+S++MMh1I=; b=t3B6LGDmgcYJqC473Oa8NIatiSKRYvi/0rNM+F/VtNA/8nXfStX1PPp+qof7pn1qk7 UyXmutXCZ1rd5HaOZMsC02x2aZC1yOYzU/q2dIEG/LY2dA3mnpIyqUuqhTIJepaMXDZu uHOnMcACOrYj82KEZAqcsjNvRMcOi2/asih54= 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=aqVm3RrrkHcHI8YCudboXuuF6xY/pviCSyU220VbdxLP/2aGNnHuN0UXU1mENZB+bF zIko/gC4WSksOFQ8BKqxN/lDYjg0N0nSg9YlqXSm5g5wfnQAIJfsm7isCkUSsQokorn5 SwC77U2LuZrDsnBBFUgiX2JON9Q04HBsXRHOY= Received: by 10.204.15.5 with SMTP id i5mr1236987bka.182.1270207918321; Fri, 02 Apr 2010 04:31:58 -0700 (PDT) Received: from bicker ([196.43.68.86]) by mx.google.com with ESMTPS id l1sm76381999bkl.2.2010.04.02.04.31.54 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 02 Apr 2010 04:31:57 -0700 (PDT) Date: Fri, 2 Apr 2010 14:31:50 +0300 From: Dan Carpenter To: Mauro Carvalho Chehab Cc: Hans Verkuil , Laurent Pinchart , Andrew Morton , Devin Heitmueller , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] cx88: improve error handling Message-ID: <20100402113150.GL5265@bicker> Mail-Followup-To: Dan Carpenter , Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Andrew Morton , Devin Heitmueller , 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 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:39:05 +0000 (UTC) diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 48c450f..b4c80cb 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -1537,9 +1537,12 @@ static int radio_queryctrl (struct file *file, void *priv, c->id >= V4L2_CID_LASTP1) return -EINVAL; if (c->id == V4L2_CID_AUDIO_MUTE) { - for (i = 0; i < CX8800_CTLS; i++) + for (i = 0; i < CX8800_CTLS; i++) { if (cx8800_ctls[i].v.id == c->id) break; + } + if (i == CX8800_CTLS) + return -EINVAL; *c = cx8800_ctls[i].v; } else *c = no_ctl;