From patchwork Thu Jan 3 18:35:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 16095 X-Patchwork-Delegate: g.liakhovetski@gmx.de Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1Tqpce-00040H-HD; Thu, 03 Jan 2013 19:34:32 +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-2) with esmtp id 1Tqpcd-0001WM-Id; Thu, 03 Jan 2013 19:34:32 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753682Ab3ACSe3 (ORCPT + 1 other); Thu, 3 Jan 2013 13:34:29 -0500 Received: from perceval.ideasonboard.com ([95.142.166.194]:50902 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753580Ab3ACSe3 (ORCPT ); Thu, 3 Jan 2013 13:34:29 -0500 Received: from avalon.ideasonboard.com (unknown [91.178.84.12]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 54B3935A69; Thu, 3 Jan 2013 19:34:28 +0100 (CET) From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: Guennadi Liakhovetski Subject: [PATCH 1/3] sh_vou: Don't modify const variable in sh_vou_s_crop() Date: Thu, 3 Jan 2013 19:35:55 +0100 Message-Id: <1357238157-18115-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 1.7.8.6 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: 2013.1.3.182126 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_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_MEDIA_BODY 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, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' The crop rectangle is const, make a local copy instead of modifying it. Signed-off-by: Laurent Pinchart --- drivers/media/platform/sh_vou.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c index 85fd312..43278de 100644 --- a/drivers/media/platform/sh_vou.c +++ b/drivers/media/platform/sh_vou.c @@ -937,7 +937,7 @@ static int sh_vou_s_crop(struct file *file, void *fh, const struct v4l2_crop *a) { struct video_device *vdev = video_devdata(file); struct sh_vou_device *vou_dev = video_get_drvdata(vdev); - struct v4l2_rect *rect = &a->c; + const struct v4l2_rect *rect = &a->c; struct v4l2_crop sd_crop = {.type = V4L2_BUF_TYPE_VIDEO_OUTPUT}; struct v4l2_pix_format *pix = &vou_dev->pix; struct sh_vou_geometry geo; @@ -961,16 +961,16 @@ static int sh_vou_s_crop(struct file *file, void *fh, const struct v4l2_crop *a) else img_height_max = 576; - v4l_bound_align_image(&rect->width, 0, VOU_MAX_IMAGE_WIDTH, 1, - &rect->height, 0, img_height_max, 1, 0); + geo.output = *rect; + v4l_bound_align_image(&geo.output.width, 0, VOU_MAX_IMAGE_WIDTH, 1, + &geo.output.height, 0, img_height_max, 1, 0); - if (rect->width + rect->left > VOU_MAX_IMAGE_WIDTH) - rect->left = VOU_MAX_IMAGE_WIDTH - rect->width; + if (geo.output.width + geo.output.left > VOU_MAX_IMAGE_WIDTH) + geo.output.left = VOU_MAX_IMAGE_WIDTH - geo.output.width; - if (rect->height + rect->top > img_height_max) - rect->top = img_height_max - rect->height; + if (geo.output.height + geo.output.top > img_height_max) + geo.output.top = img_height_max - geo.output.height; - geo.output = *rect; geo.in_width = pix->width; geo.in_height = pix->height;