Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp245791ybi; Wed, 29 May 2019 20:33:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6N9WqFKF3d8k4lQX5JapK3AbmbRslorwujt5LS/DbeMXfH23BX/d8EmKEG85gc2ZwoVwG X-Received: by 2002:a63:6c83:: with SMTP id h125mr1662767pgc.86.1559187207048; Wed, 29 May 2019 20:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559187207; cv=none; d=google.com; s=arc-20160816; b=wJzGvg/s5OaeuU6WxC3opZZGdnJh2YAVC7Na2QA9rkIoyyRD70CFF4TA4lIACDnfQS SmL1pc3o4AMasyJj+Klrd0HWDdFOov15QlZzS9bqSUhdnaltQZ7oiWuO5AVFSVDEXE03 bP8uBociuoGNfLOnMa+SmFWLjt2SsibJGpKNiPHihY2sKrDU3ENhkV/IDBH8KQ8tDO5o 3uKjQQWzrNQitwTHrn5lehKv9ouit6C5hzcSucKDBim05fS1e80AJcUv+4JEj0RzrCkB b7fPoc2vrEyvo8huSVIq3TH+VN80qCV7m2rnU2g7iDT4G7gxlIurRQG7/FlZDB/rDsxf jHHQ== 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:dkim-signature; bh=OgIu0W+0TEd0wUJHU9P1Iof8PEcKFzD2RsQQDtZCcNs=; b=QzRIrxkXlyxIOWb8yiQmtEui1ERUDfqdGPZ2IXrzEFQMPdklV3eAZvrc4N7IEKEH7z 55wFiufQ8c7FGNUVKt/XGVJTFjoR1RRJ31afQ34Fb/p99nbmtJkfTMsJHLSVep36aeno JhOe91DUgEe9DM3iwtZVZOqh+rchHZd6ddB6aCmtJd/Tpmxj1RrEnkfl4yfy9bWH1QWm HBAG2GJCq/wcnyDb39+3bGkDmhyWqIqficn/fWBowJOw2kZvUVT2npL7375QSkkciBiP nIB1M3hq9JHgIl8lodS6k/Q+egO6QHKW3oS3WiEEcIocyX+Z1T6UsWvWwoekhDn9/4uQ 8dJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Y9C3LZOe; 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 d35si508847pla.134.2019.05.29.20.33.10; Wed, 29 May 2019 20:33:27 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Y9C3LZOe; 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 S1728099AbfE3Das (ORCPT + 99 others); Wed, 29 May 2019 23:30:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:49084 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733053AbfE3Dal (ORCPT ); Wed, 29 May 2019 23:30:41 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C379424AF6; Thu, 30 May 2019 03:30:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559187040; bh=kMmh6iBL9NQyeey8nZVsGYVS5PhyCz7yCWD11jJUAMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y9C3LZOeoVLsOZnMZzKJ/Te6TlmlFd9kRUtqIr6QdkEWULuyX2yBF/PNpM+Z0jkAn sqB0NeW7wHZNeTlucd7eOXov2pFrDd4d38aHACn5aiwxCQN+0JeCkJ4v5QoxRC4KBR 9ninUbr9W1yTc6PaWuxExo1W/2gZDJh3ia1dkeTs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Lad, Prabhakar" , Akinobu Mita , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 124/276] media: ov2659: make S_FMT succeed even if requested format doesnt match Date: Wed, 29 May 2019 20:04:42 -0700 Message-Id: <20190530030533.584869940@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030523.133519668@linuxfoundation.org> References: <20190530030523.133519668@linuxfoundation.org> User-Agent: quilt/0.66 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 [ Upstream commit bccb89cf9cd07a0690d519696a00c00a973b3fe4 ] This driver returns an error if unsupported media bus pixel code is requested by VIDIOC_SUBDEV_S_FMT. But according to Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst, Drivers must not return an error solely because the requested format doesn't match the device capabilities. They must instead modify the format to match what the hardware can provide. So select default format code and return success in that case. This is detected by v4l2-compliance. Cc: "Lad, Prabhakar" Signed-off-by: Akinobu Mita Acked-by: Lad, Prabhakar Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/i2c/ov2659.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c index 4715edc8ca33e..e6a8b5669b9cc 100644 --- a/drivers/media/i2c/ov2659.c +++ b/drivers/media/i2c/ov2659.c @@ -1117,8 +1117,10 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd, if (ov2659_formats[index].code == mf->code) break; - if (index < 0) - return -EINVAL; + if (index < 0) { + index = 0; + mf->code = ov2659_formats[index].code; + } mf->colorspace = V4L2_COLORSPACE_SRGB; mf->field = V4L2_FIELD_NONE; -- 2.20.1