Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2491006imm; Mon, 24 Sep 2018 05:23:46 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdatl93rwY3txg39YU8vAXzcMgAKlOXZJgoyYd8PprwrZuCeK0aGrokWUgrBmG3wY4CjKMip X-Received: by 2002:a62:cc83:: with SMTP id j3-v6mr10198022pfk.255.1537791825971; Mon, 24 Sep 2018 05:23:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537791825; cv=none; d=google.com; s=arc-20160816; b=yxJeK3kg8DI2IHoaovmpB6OWhQsAwGdo7k5C3UPj4DY1rdHhMtUcWKzPruSesVwlCR rTv6DgEko+0Sr+4CZ4FqRFsLMhb+G9b5tnp2Mw6lP0U4Ba0W8Jc7UEg8J3EBuluGw/4y UQrG8g/vq0f/Qq0lOD36LqCN7y6vt5MS3l3d9RhxkqzHTRM6JbTPMTaXPT4ZROfh3RFx wU9TN3zAf09L7bL21ZrSFp4KG6c6sKujx0bsLx/FXgCIUspU6QFkX/lo8s0CCIbS18lr nx4P60ApVIVrfaO8JZ8uFDPYiX//UTzxlmrTyCg/gXq6e3PragiTHrNvEpZhy8H0hp+q XodQ== 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; bh=jITjvcC7ENQBwy5vmp7FcDsGxw/x//FW1A0QJkQXslo=; b=lxIJlOCYl0r4M7g6BcLl35YzZs8266J2VX5iq45/InpqIOo6RH8BW8x599BBR2oeFS Nhh7Wcbq7r/q8a8STWDGg7Ux5SuaHFJKevwtkDs6G335ONlZor29z1aOF45VRnyPuMVG d2H7Aq3kJBcsn6Ftiql/YEw7qu1zh3K39lC2V8/JBZNLxXyCHfTx9ZjFilpOO8daYbQw UfVIvXnjA50+jXaR6wKISllf52Evyf/lt11iI3zY2KhwnjtPJxU+LUC2+sGXSkl+z9VA HCRtmkK/e5HDtFCtnw4MxeeMwGwgEyKKYwxYztMks/rzm+LJ0/U0k24SFYEkHD1H5paL hF1A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u127-v6si8524794pgc.234.2018.09.24.05.23.30; Mon, 24 Sep 2018 05:23:45 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732557AbeIXSYR (ORCPT + 99 others); Mon, 24 Sep 2018 14:24:17 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56376 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732118AbeIXSYN (ORCPT ); Mon, 24 Sep 2018 14:24:13 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E91B2107E; Mon, 24 Sep 2018 12:22:20 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Enrico Scholz , Jan Luebbe , Philipp Zabel , Sasha Levin Subject: [PATCH 4.14 127/173] gpu: ipu-v3: csi: pass back mbus_code_to_bus_cfg error codes Date: Mon, 24 Sep 2018 13:52:41 +0200 Message-Id: <20180924113125.190073212@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113114.334025954@linuxfoundation.org> References: <20180924113114.334025954@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Enrico Scholz [ Upstream commit d36d0e6309dd8137cf438cbb680e72eb63c81425 ] mbus_code_to_bus_cfg() can fail on unknown mbus codes; pass back the error to the caller. Signed-off-by: Enrico Scholz Signed-off-by: Jan Luebbe [p.zabel@pengutronix.de - renamed rc to ret for consistency] Signed-off-by: Philipp Zabel Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/ipu-v3/ipu-csi.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) --- a/drivers/gpu/ipu-v3/ipu-csi.c +++ b/drivers/gpu/ipu-v3/ipu-csi.c @@ -316,13 +316,17 @@ static int mbus_code_to_bus_cfg(struct i /* * Fill a CSI bus config struct from mbus_config and mbus_framefmt. */ -static void fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg, +static int fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg, struct v4l2_mbus_config *mbus_cfg, struct v4l2_mbus_framefmt *mbus_fmt) { + int ret; + memset(csicfg, 0, sizeof(*csicfg)); - mbus_code_to_bus_cfg(csicfg, mbus_fmt->code); + ret = mbus_code_to_bus_cfg(csicfg, mbus_fmt->code); + if (ret < 0) + return ret; switch (mbus_cfg->type) { case V4L2_MBUS_PARALLEL: @@ -353,6 +357,8 @@ static void fill_csi_bus_cfg(struct ipu_ /* will never get here, keep compiler quiet */ break; } + + return 0; } int ipu_csi_init_interface(struct ipu_csi *csi, @@ -362,8 +368,11 @@ int ipu_csi_init_interface(struct ipu_cs struct ipu_csi_bus_config cfg; unsigned long flags; u32 width, height, data = 0; + int ret; - fill_csi_bus_cfg(&cfg, mbus_cfg, mbus_fmt); + ret = fill_csi_bus_cfg(&cfg, mbus_cfg, mbus_fmt); + if (ret < 0) + return ret; /* set default sensor frame width and height */ width = mbus_fmt->width; @@ -584,11 +593,14 @@ int ipu_csi_set_mipi_datatype(struct ipu struct ipu_csi_bus_config cfg; unsigned long flags; u32 temp; + int ret; if (vc > 3) return -EINVAL; - mbus_code_to_bus_cfg(&cfg, mbus_fmt->code); + ret = mbus_code_to_bus_cfg(&cfg, mbus_fmt->code); + if (ret < 0) + return ret; spin_lock_irqsave(&csi->lock, flags);