From patchwork Wed Nov 28 20:15:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 15725 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1Tdo3H-0007AR-6y for patchwork@linuxtv.org; Wed, 28 Nov 2012 21:16:11 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-3) with esmtp for id 1Tdo3G-0001yV-FB; Wed, 28 Nov 2012 21:16:11 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932269Ab2K1UPz (ORCPT ); Wed, 28 Nov 2012 15:15:55 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:39387 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932196Ab2K1UPy (ORCPT ); Wed, 28 Nov 2012 15:15:54 -0500 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3YBY5h3mP8z4KK3g; Wed, 28 Nov 2012 21:15:52 +0100 (CET) X-Auth-Info: O7iwrqYD6S3CJc+EtHieAppu07nmU+9n0FOdV7Rgz/4= Received: from localhost (p4FDE7DA4.dip.t-dialin.net [79.222.125.164]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA id 3YBY5h1wpGzbbfy; Wed, 28 Nov 2012 21:15:52 +0100 (CET) From: Anatolij Gustschin To: linux-media@vger.kernel.org Cc: Guennadi Liakhovetski Subject: [PATCH] soc_camera: fix VIDIOC_S_GROP ioctl Date: Wed, 28 Nov 2012 21:15:51 +0100 Message-Id: <1354133751-31985-1-git-send-email-agust@denx.de> X-Mailer: git-send-email 1.7.1 In-Reply-To: References: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.11.28.200315 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1500_1599 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' Sometimes VIDIOC_S_GROP ioctl doesn't work, soc-camera driver reports: soc-camera-pdrv soc-camera-pdrv.0: S_CROP denied: getting current crop failed The VIDIOC_G_CROP documentation states that the type field needs to be set to the respective buffer type when querying, so the check in .g_crop() of the subdevices returns -EINVAL if the type is not set properly. Here the uninitialized local variable 'current_crop' is passed to the .g_crop() and this leads to the observed error. Initialize the type field of the local 'current_crop' before get_crop call. Signed-off-by: Anatolij Gustschin --- drivers/media/platform/soc_camera/soc_camera.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index d3f0b84..7ebc784 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -902,6 +902,8 @@ static int soc_camera_s_crop(struct file *file, void *fh, dev_dbg(icd->pdev, "S_CROP(%ux%u@%u:%u)\n", rect->width, rect->height, rect->left, rect->top); + current_crop.type = a->type; + /* If get_crop fails, we'll let host and / or client drivers decide */ ret = ici->ops->get_crop(icd, ¤t_crop);