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: 1929051 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 521243FE37 for ; Thu, 3 Jan 2013 18:34:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753682Ab3ACSe3 (ORCPT ); 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 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;