From patchwork Wed May 25 19:10:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 9136127 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 805846075C for ; Wed, 25 May 2016 19:20:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 723C725EF7 for ; Wed, 25 May 2016 19:20:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66A9227BF0; Wed, 25 May 2016 19:20:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A07A25EF7 for ; Wed, 25 May 2016 19:20:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751919AbcEYTUC (ORCPT ); Wed, 25 May 2016 15:20:02 -0400 Received: from smtp-4.sys.kth.se ([130.237.48.193]:35803 "EHLO smtp-4.sys.kth.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751838AbcEYTTv (ORCPT ); Wed, 25 May 2016 15:19:51 -0400 Received: from smtp-4.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-4.sys.kth.se (Postfix) with ESMTP id 1A7AD31AD; Wed, 25 May 2016 21:19:49 +0200 (CEST) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-4.sys.kth.se ([127.0.0.1]) by smtp-4.sys.kth.se (smtp-4.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id XlLCpVbSwkNl; Wed, 25 May 2016 21:19:48 +0200 (CEST) X-KTH-Auth: niso [89.233.230.99] X-KTH-mail-from: niklas.soderlund@ragnatech.se Received: from bismarck.berto.se (dynamic.0.6.79d1f80.14cc20ac3a53.cust.bredband2.com [89.233.230.99]) by smtp-4.sys.kth.se (Postfix) with ESMTPSA id D558C317F; Wed, 25 May 2016 21:19:47 +0200 (CEST) From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= To: linux-media@vger.kernel.org, ulrich.hecht@gmail.com, hverkuil@xs4all.nl Cc: linux-renesas-soc@vger.kernel.org, Ulrich Hecht , William Towle , =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [PATCH 2/8] media: rcar_vin: Use correct pad number in try_fmt Date: Wed, 25 May 2016 21:10:03 +0200 Message-Id: <1464203409-1279-3-git-send-email-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.8.2 In-Reply-To: <1464203409-1279-1-git-send-email-niklas.soderlund@ragnatech.se> References: <1464203409-1279-1-git-send-email-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ulrich Hecht Fix rcar_vin_try_fmt's use of an inappropriate pad number when calling the subdev set_fmt function - for the ADV7612, IDs should be non-zero. Signed-off-by: William Towle Reviewed-by: Rob Taylor Acked-by: Hans Verkuil [uli: adapted to rcar-vin rewrite] Signed-off-by: Ulrich Hecht Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 929816b..3788f8a 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -98,7 +98,7 @@ static int __rvin_try_format_source(struct rvin_dev *vin, struct rvin_source_fmt *source) { struct v4l2_subdev *sd; - struct v4l2_subdev_pad_config pad_cfg; + struct v4l2_subdev_pad_config *pad_cfg; struct v4l2_subdev_format format = { .which = which, }; @@ -108,10 +108,16 @@ static int __rvin_try_format_source(struct rvin_dev *vin, v4l2_fill_mbus_format(&format.format, pix, vin->source.code); + pad_cfg = v4l2_subdev_alloc_pad_config(sd); + if (pad_cfg == NULL) + return -ENOMEM; + + format.pad = vin->src_pad_idx; + ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, pad, set_fmt, - &pad_cfg, &format); + pad_cfg, &format); if (ret < 0) - return ret; + goto cleanup; v4l2_fill_pix_format(pix, &format.format); @@ -121,6 +127,8 @@ static int __rvin_try_format_source(struct rvin_dev *vin, vin_dbg(vin, "Source resolution: %ux%u\n", source->width, source->height); +cleanup: + v4l2_subdev_free_pad_config(pad_cfg); return 0; }