Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2988725imu; Mon, 19 Nov 2018 09:02:54 -0800 (PST) X-Google-Smtp-Source: AJdET5eyiwXrTuy1TzgatoLxKZNSQKwW0Tel6rlAu+PNz2MVqkeNgPpp02Pfh6wu9Nv/1byht+cp X-Received: by 2002:a65:64c8:: with SMTP id t8mr1012313pgv.31.1542646974875; Mon, 19 Nov 2018 09:02:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542646974; cv=none; d=google.com; s=arc-20160816; b=fv/kauAjBCYvcgcGtFjSoC+dzNSJRPPW/RzJaYWbI3U+MRiVGr/HXAvOylyTYwsqxj i8AqPq+uCjq5kehHdJzEyT1+kNBCs/sxPwnBIDVj0Ke1z8Iv5pgLb2aTo1NP7yQW7Bi+ OrEjKPaGLbatzAZox72oTMUkdwbPRwtnPmaFgmk2vNxoC55YrJlW28nurvv9/qVDcDbU 3jRh0j1sB3tQH0CrZy7+R3LuS5c14/YZ86HXw28XKtTMLfL2vJMf5+PP6TIPIuy3r/9e ZjWmjTjAWhwXfv95fqqdpJDpaUM5N4EKtQpfFf2x8XUg5AIuv9YegRA536wuziT1aJOR 4eFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=34NcvUD+XYW82F2XeWxOp3lpaDybJsUGXUhYOqBBfY0=; b=JnuBnJaap95TFDcF8sH5gZORUxVcSFo2NNLKrkXA4UxaES+RyeEaZeSUe17njTwKIe 2E17PVqVuyv8mtzjZ9S9C/sU0FEOjw2nxLe+6qVkt9TBYqFKDWIuvaX90zuQp6CXI4rZ T68bYif2rP83mbiCZg1Lm9kV+m3rDVMQ07zl2SIzvqBJNPbdUsxnX2WefU8IjoJLXkEK INiB/kwUw7URL5LtCU8Ev5moYvWRUODTHrc4AuVYWf8i/zjUahJkYaxH+qqWSzTfu8E3 NPio18e1ilgTIONFkFipR3DBaM/I8VMIQ0ZxqR6aOYxdgIfjayl50WbisG+UW8ffd7vg O9JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DaftfHoy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w1-v6si44596530plk.317.2018.11.19.09.02.33; Mon, 19 Nov 2018 09:02:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DaftfHoy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405379AbeKTDYm (ORCPT + 99 others); Mon, 19 Nov 2018 22:24:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:37588 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405346AbeKTDYm (ORCPT ); Mon, 19 Nov 2018 22:24:42 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EBB7B21780; Mon, 19 Nov 2018 17:00:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542646826; bh=gXMf1nTIe927W/EvVPUSX46Wgpjv9ajf/hO07S2tl5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DaftfHoy9i1X41epfr7Wl+3Xyg2uKBDxnUS9tt/TQCMioc2MKW1UBp2MdFM2Nuxhw Pg5Nj6Gn/lgNSQv+XzAPzbaoz6QOGWmGNdw/FK15WAp0wvuN36cH7jwL1dvKjzHTHg IX2c7Gelx0s2SC/g6ZQEw1DoQf9MqFO8PLgvWXJ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marco Felsch , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.4 103/160] media: tvp5150: fix width alignment during set_selection() Date: Mon, 19 Nov 2018 17:29:02 +0100 Message-Id: <20181119162640.935976652@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162630.031306128@linuxfoundation.org> References: <20181119162630.031306128@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marco Felsch [ Upstream commit bd24db04101f45a9c1d874fe21b0c7eab7bcadec ] The driver ignored the width alignment which exists due to the UYVY colorspace format. Fix the width alignment and make use of the the provided v4l2 helper function to set the width, height and all alignments in one. Fixes: 963ddc63e20d ("[media] media: tvp5150: Add cropping support") Signed-off-by: Marco Felsch Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/media/i2c/tvp5150.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) --- a/drivers/media/i2c/tvp5150.c +++ b/drivers/media/i2c/tvp5150.c @@ -870,9 +870,6 @@ static int tvp5150_s_crop(struct v4l2_su /* tvp5150 has some special limits */ rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT); - rect.width = clamp_t(unsigned int, rect.width, - TVP5150_H_MAX - TVP5150_MAX_CROP_LEFT - rect.left, - TVP5150_H_MAX - rect.left); rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP); /* Calculate height based on current standard */ @@ -886,9 +883,16 @@ static int tvp5150_s_crop(struct v4l2_su else hmax = TVP5150_V_MAX_OTHERS; - rect.height = clamp_t(unsigned int, rect.height, + /* + * alignments: + * - width = 2 due to UYVY colorspace + * - height, image = no special alignment + */ + v4l_bound_align_image(&rect.width, + TVP5150_H_MAX - TVP5150_MAX_CROP_LEFT - rect.left, + TVP5150_H_MAX - rect.left, 1, &rect.height, hmax - TVP5150_MAX_CROP_TOP - rect.top, - hmax - rect.top); + hmax - rect.top, 0, 0); tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top); tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP,