Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp719981ybt; Wed, 17 Jun 2020 12:07:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEleDuqncrRSuA90/pgcp5v5v5TxxPGpN8cLg4XV/5sMpBSjQ5g716vjYPaqqKgoYXx+lN X-Received: by 2002:a50:bb41:: with SMTP id y59mr564828ede.311.1592420859307; Wed, 17 Jun 2020 12:07:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592420859; cv=none; d=google.com; s=arc-20160816; b=Gf1RJbevtoIwfowKCdXa1i3hasEs8Uic59sdgpNdZ5zgPQl8rQhtiYoebcyqtnHPuV e8UaQDCBI1mRRSxTSfQwa3vKzI7jOnwrkkYXQGofpl/K5EQS01X2i7phrNFdkVzjNhnc DbliEjOv4/WdGMWoQfLV442z2yrwiuf5srhs1aG+1bbCB0IZ/GNG6K0WNM9luiLc0KEB vYiRFXqZX2Y+cWuthwQv9vDI3qrffSc+GD+m6ObHbGhebULr7UaTPEE2xww8diL2yAf/ K56VOuuSiqb8hK0v4+itpkbw1xAWCR8FUvGLhmsTSbgZDa/0TeymuUB+VoETigCyc3+6 /snA== 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 :message-id:date:subject:cc:to:from; bh=JsWMbfUU2jN+V+sCwFWPl/QTGZA4nxZKEk6Y0Ynu/y8=; b=MKoxtT0V1NBTFKyX6eu0TrlkV0325BZ2r07Yzv1L/J76ZesOnZfCcisjWlHlV4oBaw Jxfm5IzIB32A1o9q7XGzklPiMXPRcc4as9+mpCL+4g9MtpnDr5ul43ZDBSD0G1uBlFJL Wj6CB1+khssjPaqwPcAuXaNppahOvYpKeljX772ZDmaq0KqgOGfb5a3WBcceO94UbOvv 3wZB7qOFsMfuGbeVCURHKMUAGhpeiIPprR9X8eA/xhC/9c6SeD6KApOkjbyUaDUEZGCP wBTcp5cfmkUn4s0FVBihtDSRSonEC7Tny5BWR7xPuPjDEFulMpEM/3FQIxHzNE9IT3a9 UVsw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e19si541890edr.418.2020.06.17.12.07.16; Wed, 17 Jun 2020 12:07:39 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727768AbgFQSWy (ORCPT + 99 others); Wed, 17 Jun 2020 14:22:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726835AbgFQSWx (ORCPT ); Wed, 17 Jun 2020 14:22:53 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4102C06174E; Wed, 17 Jun 2020 11:22:53 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: koike) with ESMTPSA id 54F0A2A3FD9 From: Helen Koike To: linux-media@vger.kernel.org Cc: mchehab@kernel.org, dafna.hirschfeld@collabora.com, linux-kernel@vger.kernel.org, tfiga@google.com, hans.verkuil@cisco.com, kernel@collabora.com, Helen Koike , Wojciech Zabolotny Subject: [PATCH] media: staging: rkisp1: isp: check return value from phy_* Date: Wed, 17 Jun 2020 15:22:29 -0300 Message-Id: <20200617182229.164675-1-helen.koike@collabora.com> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) 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) { + dev_err(sensor->sd->dev, "Fail setting MIPI DPHY mode\n"); + return -EINVAL; + } + + ret = phy_configure(sensor->dphy, &opts); + if (ret && ret != -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; + } return 0; } -- 2.26.0