From patchwork Tue Jan 27 06:02:41 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 4703 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0U9IMmK022664 for ; Fri, 30 Jan 2009 09:18:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751023AbZA3JSV (ORCPT ); Fri, 30 Jan 2009 04:18:21 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751407AbZA3JSV (ORCPT ); Fri, 30 Jan 2009 04:18:21 -0500 Received: from mail.renesas.com ([202.234.163.13]:60261 "EHLO mail04.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751023AbZA3JSU (ORCPT ); Fri, 30 Jan 2009 04:18:20 -0500 X-AuditID: ac140387-00000008000005fd-5a-4982c5d70b66 Received: from guardian02.idc.renesas.com ([172.20.8.201]) by mail04.idc.renesas.com (sendmail) with ESMTP id n0U9IE74016706; Fri, 30 Jan 2009 18:18:14 +0900 (JST) Received: (from root@localhost) by guardian02.idc.renesas.com with id n0U9ID81004555; Fri, 30 Jan 2009 18:18:13 +0900 (JST) Received: from mta01.idc.renesas.com (localhost [127.0.0.1]) by mta01.idc.renesas.com with ESMTP id n0U9IDPC027684; Fri, 30 Jan 2009 18:18:13 +0900 (JST) Received: from PG10870.renesas.com ([172.30.8.159]) by ims05.idc.renesas.com (Sendmail) with ESMTPA id <0KEA000BQ1UDL6@ims05.idc.renesas.com>; Fri, 30 Jan 2009 18:18:13 +0900 (JST) Date: Tue, 27 Jan 2009 15:02:41 +0900 From: Kuninori Morimoto Subject: [PATCH] tw9910: color format check is added on set_fmt To: Guennadi Liakhovetski Cc: Linux Media Message-id: MIME-version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-type: text/plain; charset=US-ASCII User-Agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.7 Emacs/22.1 (i386-mingw-nt5.1.2600) MULE/5.0 (SAKAKI) Meadow/3.00-dev (KIKU) X-Brightmail-Tracker: AAAAAA== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Signed-off-by: Kuninori Morimoto --- drivers/media/video/tw9910.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c index 1a9c6fd..57027c0 100644 --- a/drivers/media/video/tw9910.c +++ b/drivers/media/video/tw9910.c @@ -647,6 +647,19 @@ static int tw9910_set_fmt(struct soc_camera_device *icd, __u32 pixfmt, struct tw9910_priv *priv = container_of(icd, struct tw9910_priv, icd); int ret = -EINVAL; u8 val; + int i; + + /* + * check color format + */ + for (i = 0 ; i < ARRAY_SIZE(tw9910_color_fmt) ; i++) { + if (pixfmt == tw9910_color_fmt[i].fourcc) { + ret = 0; + break; + } + } + if (ret < 0) + goto tw9910_set_fmt_error; /* * select suitable norm