Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp576825ybe; Fri, 6 Sep 2019 04:09:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqx0taRRtjm1Bpf694WLBeM3XpGmuHb5ZdT9FBc2d2ifjmBQzbitkJz1ThWe/0qXNKi2Kken X-Received: by 2002:a17:902:421:: with SMTP id 30mr8868764ple.105.1567768177369; Fri, 06 Sep 2019 04:09:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567768177; cv=none; d=google.com; s=arc-20160816; b=xVdzn0P+7skEpfEtbMOUTIH8H4m1sxei1SVJvNAGdmu5SDYTKAKJ6aWfh7nXqmqjEO fet0Qvf/UL4x+Pvc3xoTI8RyHrqRYHWvLIKZdT0H8bxT5p3K1egBRoPgpH3U1MsHCVCH WTmUDHEMCeAfxBlI0CBy+Vawu4vjfOAscp9zN5vNGY43EHSRt9M2wsQsMpPhAhF3a+H4 RqBSu0hlqvnxyPNrujfFlE9As6pZjv4QcCqHU4f3VrlYLcPCIfR5Vbo15Ckp4hMpnWEQ 64O/TnRS/DZf3w4zo/HCz5GkkeGXQ9GBOE6QGKjmv0yD2uppOTYBYv2gLYdvn3csnUBn P/sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=8yLKZmCPxNAn/bu6+/r5wU9wMnRnPIWM1VI9DzVbOvM=; b=wnXiXz10liuwo7rM2OcrxyMwiPMqR8ht4Hh+NhenjPYRsT2V9tOpwTWSf5rC8UV+9U yhlAroHlRZURa4qNbl1erbBpn33W9ommCey9J/XILCpISkvB5v90WJzf/5ijo+3C7uQF F3YHCR2fAomS/sa0SEWKGe873ysppZfK5SC9r4xhd2RYWAyhGrGkXFL/ogDLG9Zvjrh+ 70SQqox16CDBdgQgXsSe4QeAI/BBYYVHtSVE2ZVPlyBgTN03PpWcQecCjzNATZY/Am0z feZMB31tXz6J6v8nlTu0moLypXtPLDcEE0viX5nNkcYUKJJRivk5n3LSo2iesDYi+ZHx 3ksA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=iki.fi Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x7si4759926pll.79.2019.09.06.04.09.21; Fri, 06 Sep 2019 04:09:37 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=iki.fi Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387435AbfIFHy3 (ORCPT + 99 others); Fri, 6 Sep 2019 03:54:29 -0400 Received: from retiisi.org.uk ([95.216.213.190]:54912 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725290AbfIFHy3 (ORCPT ); Fri, 6 Sep 2019 03:54:29 -0400 Received: from valkosipuli.localdomain (valkosipuli.retiisi.org.uk [IPv6:2a01:4f9:c010:4572::80:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hillosipuli.retiisi.org.uk (Postfix) with ESMTPS id C6EAA634C87; Fri, 6 Sep 2019 10:54:13 +0300 (EEST) Received: from sailus by valkosipuli.localdomain with local (Exim 4.92) (envelope-from ) id 1i694P-0000kT-Pu; Fri, 06 Sep 2019 10:54:13 +0300 Date: Fri, 6 Sep 2019 10:54:13 +0300 From: Sakari Ailus To: Jan Kotas Cc: maxime.ripard@bootlin.com, mchehab@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, rafalc@cadence.com, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/3] media: Add lane checks for Cadence CSI2RX Message-ID: <20190906075413.GE1586@valkosipuli.retiisi.org.uk> References: <20190905105601.27034-1-jank@cadence.com> <20190905105601.27034-3-jank@cadence.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190905105601.27034-3-jank@cadence.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jan, Thanks for the patchset. On Thu, Sep 05, 2019 at 11:56:00AM +0100, Jan Kotas wrote: > This patch adds lane checks for CSI2RX, to prevent clock lane > being used as a data lane. > > Signed-off-by: Jan Kotas > --- > drivers/media/platform/cadence/cdns-csi2rx.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c > index 31ace114e..97ec09e72 100644 > --- a/drivers/media/platform/cadence/cdns-csi2rx.c > +++ b/drivers/media/platform/cadence/cdns-csi2rx.c > @@ -2,7 +2,7 @@ > /* > * Driver for Cadence MIPI-CSI2 RX Controller v1.3 > * > - * Copyright (C) 2017 Cadence Design Systems Inc. > + * Copyright (C) 2017-2019 Cadence Design Systems Inc. > */ > > #include > @@ -364,7 +364,7 @@ static int csi2rx_parse_dt(struct csi2rx_priv *csi2rx) > struct v4l2_fwnode_endpoint v4l2_ep = { .bus_type = 0 }; > struct fwnode_handle *fwh; > struct device_node *ep; > - int ret; > + int ret, i; > > ep = of_graph_get_endpoint_by_regs(csi2rx->dev->of_node, 0, 0); > if (!ep) > @@ -395,6 +395,15 @@ static int csi2rx_parse_dt(struct csi2rx_priv *csi2rx) > return -EINVAL; > } > > + for (i = 0; i < csi2rx->num_lanes; i++) { > + if (csi2rx->lanes[i] < 1) { Do you need this? v4l2_fwnode_parse_endpoint() already has a more thorough check for the lane numbers. > + dev_err(csi2rx->dev, "Invalid lane[%d] number: %u\n", > + i, csi2rx->lanes[i]); > + of_node_put(ep); > + return -EINVAL; > + } > + } > + > csi2rx->asd.match.fwnode = fwnode_graph_get_remote_port_parent(fwh); > csi2rx->asd.match_type = V4L2_ASYNC_MATCH_FWNODE; > of_node_put(ep); -- Regards, Sakari Ailus