From patchwork Wed May 5 06:01:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 96987 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 o4561g02028343 for ; Wed, 5 May 2010 06:01:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755447Ab0EEGBk (ORCPT ); Wed, 5 May 2010 02:01:40 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:60929 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755382Ab0EEGBi (ORCPT ); Wed, 5 May 2010 02:01:38 -0400 Received: by fxm10 with SMTP id 10so3901101fxm.19 for ; Tue, 04 May 2010 23:01:37 -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:mime-version:content-type:content-disposition:user-agent; bh=L3jll+MuDIV6Zv1T5rzuH7AV/95Cu+1cW3faKqpr0VA=; b=QZ4kEJkZ10F0SCJaiB4QIHQzaBv41BeNMFtXtZ/S8Ibhi1KfZgdpgFLfacELkZmqNw szRMGomahehxbUxdqzkwb1JopAJ10i75dm+IQk7wDAfMtvU+tYWINnx5WnuTuQ5ZoICH bcoQzfGribw2pBM1AHtiAx3cUscZ5E9VmLs5g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=jrgOLR9OSu34LkAbem9bPJzmmaied9pPRT07CGojAN4+OoGymVTcWqVOMJziJuknGK tQCeMFBVTLuKPpvIDe5+MaOURfzrCo+DkXxJUjVBxqC1Dx5w1tmRizZSiflBujYIH3e7 xCLo1P0anikxi6HeptnA7mWkwJJj9NWZjsOxQ= Received: by 10.223.51.152 with SMTP id d24mr4974444fag.36.1273039296949; Tue, 04 May 2010 23:01:36 -0700 (PDT) Received: from bicker ([205.177.176.130]) by mx.google.com with ESMTPS id 1sm12845652fks.24.2010.05.04.23.01.34 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 04 May 2010 23:01:36 -0700 (PDT) Date: Wed, 5 May 2010 08:01:30 +0200 From: Dan Carpenter To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab Subject: [patch -next 1/2] media/s2255drv: return if vdev not found Message-ID: <20100505060130.GG27064@bicker> 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]); Wed, 05 May 2010 06:01:43 +0000 (UTC) diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index ac9c40c..1f9a49e 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c @@ -1716,11 +1716,15 @@ static int s2255_open(struct file *file) dprintk(1, "s2255: open called (dev=%s)\n", video_device_node_name(vdev)); - for (i = 0; i < MAX_CHANNELS; i++) + for (i = 0; i < MAX_CHANNELS; i++) { if (&dev->vdev[i] == vdev) { cur_channel = i; break; } + } + if (i == MAX_CHANNELS) + return -ENODEV; + /* * open lock necessary to prevent multiple instances * of v4l-conf (or other programs) from simultaneously