Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2511439imm; Mon, 24 Sep 2018 05:42:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV63iCqQhjXKEzkZabfwaxL0atPPzWIhnL8bN0+YQiCtY8oyVkeNl2XcF32cZgKXspTql0Fhv X-Received: by 2002:a63:b23:: with SMTP id 35-v6mr8013789pgl.301.1537792959708; Mon, 24 Sep 2018 05:42:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792959; cv=none; d=google.com; s=arc-20160816; b=rN9TRit+fNRdkOjERGV6Pem9GPowccrospRKRsnaTIehe4v/9H3T2pHzgioWjERVvU vAc2jqZfIrxgH3QJYBiYSNCW1/giJALibaUr7eHuR45D4UVK+sS0eN2VR8C20Oirmn6b DVRH/AkZR8/434UHawhusRZL8ujhe2oIXlibIt/VCGcdbtIWrmuswoBtPOUMmLG0VBij rK6aVYuJZFBynAGRByyXUTzrpzs89Gzon+H8l8h1pEfFf+hjA2IBQKVrJvGocwNypqnh MAiS/+00SoxCx9COhozBxlt1P92HMw8eaLPoD3YUQBEyBzZH8ghAl6LKny3kP9V2NZPy o5mQ== 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=DVYGiwQo6zHOnp5prtX/npwaA1cG4X6zUMcpKxfvg1Q=; b=DRKLG/Y4gohQCLUdJMZrIep8qeFtvARcz5kvwLb9s4G1TWti2d7QTCqArTjSpZIkNj ZFG8lZJAPJlmol3LfZEuXBDLtcz4CokX3/uYRoxpz4N4c+OuzvkaRfgHqKPwofi7te9q l++f1T2XJhMuIOk0LQeplcemb0wPaEo6QMbYO5UI1EKaWbl+HYX/vGzBxhEU00vTd+QO +OG/BTfuG30uSpww5luniHDU/4V2yPjVH/Fm0yiRxhwbwQy0hcqdMK2oCNieeOq6xNi1 O0+pfIzrwqewaGCqQs3QvmW7LX9qOSIF6/GMj4cNdxoxSN/UAr9Tto9gJUsznjfIWRUF 5+gg== 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 b23-v6si33167942pls.349.2018.09.24.05.42.24; Mon, 24 Sep 2018 05:42:39 -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 S2388774AbeIXSnX (ORCPT + 99 others); Mon, 24 Sep 2018 14:43:23 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59132 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730507AbeIXSnW (ORCPT ); Mon, 24 Sep 2018 14:43:22 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9B62B109A; Mon, 24 Sep 2018 12:41:24 +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.18 175/235] gpu: ipu-v3: csi: pass back mbus_code_to_bus_cfg error codes Date: Mon, 24 Sep 2018 13:52:41 +0200 Message-Id: <20180924113122.299623629@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@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.18-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 @@ -318,13 +318,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: @@ -356,6 +360,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, @@ -365,8 +371,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; @@ -587,11 +596,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);