Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp790353ybt; Wed, 17 Jun 2020 14:11:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywv3pTQ7E9pOhhniPxR+E8nrAYoo/iNOPSOzctjMhYsDP0mRsRO3FX0DjdfwZ8bjtl3DAw X-Received: by 2002:a17:906:1c93:: with SMTP id g19mr1037459ejh.194.1592428305377; Wed, 17 Jun 2020 14:11:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592428305; cv=none; d=google.com; s=arc-20160816; b=qVlOrOsCn7unqjhP8Kf77f9TddLRB1K2O6Wvwc42F5/P6etwOjlTOFgLjx4p6YI006 FEJFiU3Q4GtJzRWSa6y/UejADeHOVbFJphcVVpDkDg+huFyaRTto7FRauJXD0jbI9WRD IgUS8i8ku22F2zAGVEIGrmYpB10QldlmClTzRdcj4OMfjPUSU6xXsz6ETBSN9om+Cy9e Wv3E4NQlB88IuG/Rx7vUnJKk5F4Pw6De8Ho2xcOx7/AqLQOs5KDO9XdUJ+xVNtWv295V 0MHg8/enuyuIjTyyOiYUuKham/hrp2gRehkun73ZHQXc4T+ELPopN2IUNBsRQ5k4kBwL F5DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ikmoUr6wNmodBgxmQ4g8ECiTcai8GP8d0AhUemgSHO8=; b=XZN6NXciUo2QiXtbxBm1K7H27CjeKMpoLT5hlSChASV/nlB9Z5n/R/xDapdch8tZ+n ifr3q6MM/oh8aTm5e+XojCkwHQJJ3fsFYRAs0G7/BXkagX2UepM4vzNxuOoUXPt9xV4P fVLxjsZiqdzUEH4G3VMD2WUweSrZFRxwWGkx04b7McMPq6NbQa+9Yvpd+Suyfk6/GCKD 8Wwjt24Y/XDCtLWl0SaK7A9Z2TlVB42Lt728zHynIBL1rCQ54RN7pvquSzhas/7buM+s 2egHvY2achSnoEBprctpmpUFCqtHlsFDWBd3p2AoEq3LWV1Pa8VnhukqmQaUfYQz9n6y CRIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZbCyWzUc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f17si678448edr.515.2020.06.17.14.11.22; Wed, 17 Jun 2020 14:11:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZbCyWzUc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726899AbgFQVJC (ORCPT + 99 others); Wed, 17 Jun 2020 17:09:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726758AbgFQVJA (ORCPT ); Wed, 17 Jun 2020 17:09:00 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A7CFC061755 for ; Wed, 17 Jun 2020 14:08:59 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id y78so943161wmc.0 for ; Wed, 17 Jun 2020 14:08:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ikmoUr6wNmodBgxmQ4g8ECiTcai8GP8d0AhUemgSHO8=; b=ZbCyWzUcNY7xey+81jniW95DUP+ILcTS9Msa5jg4HLxPv25RR5rrzIIIFvRtGTpLjz vAvAtRjL5EXjYfIoE4GEMWp8OI3PL1gYGuZi62FeKD5XBz+kJCNdG8/wfwUIQZy0srB8 6HYlAwRYMIaTemMv5FqfPOU6lpf2KfTjmH5SU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ikmoUr6wNmodBgxmQ4g8ECiTcai8GP8d0AhUemgSHO8=; b=B/HFPyymipxD+VKhIf41Sk33lPHk+rP1vRVy9KlbKrzUSe3l4wyQVpTbdGc8mUEoKH WQtVn8TOgEc0XoqzEK+SSl2/FK01uhTeFrVeB700h+DOT5T6XXcBEbvtFDTtW8iJ3SHF 9MnrPJEzmerQhFWwSgj5LEn5rM8bZXCIbRsyMXcgOQYmFqHy81AmPf0eRa0CGS/7vY+X xgx7beNotZkkE6k3LeLj67H4cRWsXEgWKaYrPihu7GlFVRP4hgvMry5boXUTfX4K+f7L UsjR7/OlBmnJJeDfQ5MsvaFYSlW4Y1QECd3UnNOmtlbY8B2AW4qyfHruLHySMHvsvGp6 Acbw== X-Gm-Message-State: AOAM5308s+lzOmd2EOBT50wAvwtQvj6Y9RQEA/rCvgJGEUQWf9eQ5eFn 7wrql0Mo/qA1U4C/tCV9KRuMOg== X-Received: by 2002:a7b:cc82:: with SMTP id p2mr567186wma.101.1592428137695; Wed, 17 Jun 2020 14:08:57 -0700 (PDT) Received: from chromium.org (205.215.190.35.bc.googleusercontent.com. [35.190.215.205]) by smtp.gmail.com with ESMTPSA id t188sm1014794wmt.27.2020.06.17.14.08.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2020 14:08:57 -0700 (PDT) Date: Wed, 17 Jun 2020 21:08:55 +0000 From: Tomasz Figa To: Helen Koike Cc: linux-media@vger.kernel.org, mchehab@kernel.org, dafna.hirschfeld@collabora.com, linux-kernel@vger.kernel.org, tfiga@google.com, hans.verkuil@cisco.com, kernel@collabora.com, Wojciech Zabolotny Subject: Re: [PATCH] media: staging: rkisp1: isp: check return value from phy_* Message-ID: <20200617210855.GA81308@chromium.org> References: <20200617182229.164675-1-helen.koike@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200617182229.164675-1-helen.koike@collabora.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Helen, On Wed, Jun 17, 2020 at 03:22:29PM -0300, Helen Koike wrote: > When starting streaming, do not ignore return value from phy_set_mode(), > phy_configure() and phy_power_on(). > If it fails, return error to the user. > > Fixes: d65dd85281fb ("media: staging: rkisp1: add Rockchip ISP1 base driver") > > Reported-by: Wojciech Zabolotny > Signed-off-by: Helen Koike > > --- > > drivers/staging/media/rkisp1/rkisp1-isp.c | 22 +++++++++++++++++++--- > 1 file changed, 19 insertions(+), 3 deletions(-) > Thank you for the patch. Please see my comments inline. > diff --git a/drivers/staging/media/rkisp1/rkisp1-isp.c b/drivers/staging/media/rkisp1/rkisp1-isp.c > index dc2b59a0160a8..531047fc34a01 100644 > --- a/drivers/staging/media/rkisp1/rkisp1-isp.c > +++ b/drivers/staging/media/rkisp1/rkisp1-isp.c > @@ -892,6 +892,7 @@ static int rkisp1_mipi_csi2_start(struct rkisp1_isp *isp, > union phy_configure_opts opts; > struct phy_configure_opts_mipi_dphy *cfg = &opts.mipi_dphy; > s64 pixel_clock; > + int ret; > > if (!sensor->pixel_rate_ctrl) { > dev_warn(sensor->sd->dev, "No pixel rate control in subdev\n"); > @@ -906,9 +907,24 @@ static int rkisp1_mipi_csi2_start(struct rkisp1_isp *isp, > > phy_mipi_dphy_get_default_config(pixel_clock, isp->sink_fmt->bus_width, > sensor->lanes, cfg); > - phy_set_mode(sensor->dphy, PHY_MODE_MIPI_DPHY); > - phy_configure(sensor->dphy, &opts); > - phy_power_on(sensor->dphy); > + > + ret = phy_set_mode(sensor->dphy, PHY_MODE_MIPI_DPHY); > + if (ret) { nit: I don't seem to be able to find any documentation for this API and it's not clear if it's guaranteed that the API doesn't return positive values. It would probably be safer to check for ret < 0. > + dev_err(sensor->sd->dev, "Fail setting MIPI DPHY mode\n"); > + return -EINVAL; Should we just return ret? > + } > + > + ret = phy_configure(sensor->dphy, &opts); > + if (ret && ret != -EOPNOTSUPP) { Why are we okay with -EOPNOTSUPP? > + dev_err(sensor->sd->dev, "Fail configuring MIPI DPHY\n"); > + return -EINVAL; > + } > + > + ret = phy_power_on(sensor->dphy); > + if (ret) { > + dev_err(sensor->sd->dev, "Fail powering on MIPI DPHY\n"); > + return -EINVAL; Ditto. Best regards, Tomasz