Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3624728pxb; Mon, 24 Jan 2022 13:47:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJx4xUdVqkTcdnlosmbSTYcjmEbm7rxKu5W9ks1nGBwl3U1ogTxaktP9Ng/1mLVzdUTknML+ X-Received: by 2002:a05:6a00:1342:b0:4c2:a000:bf8 with SMTP id k2-20020a056a00134200b004c2a0000bf8mr15434612pfu.41.1643060788918; Mon, 24 Jan 2022 13:46:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643060788; cv=none; d=google.com; s=arc-20160816; b=bIfoBnPGa02z+g81d/2bJPBIeJv0w2/lbC3ihj+PkwkPQUfE0agIEXCoQXTAeiAiU5 KlM7mnkc8wGlmz2FXv2oeQ02YEqxR6LGNOSWTTcX4tcge1bCNTNFHSI7sD7Eo5AwaUP1 Sm2hxNfkLQIAmr2KfrO4QvbY2TMBpcZsGJKHn29tP/74TxwY00n9IjnXGGj5O51l7nCA t6I0N8QcB8Kg1VGeylbw4SIz26PGFjspZ42heRtFW60k1iEIcUyZ9sVQ8cUGzdm6PAbE FTjhcvhMmz6GewPQM+fVoJzrlFrnSZ7rf8xN4WZ2yx7MYUTVAQgGZgZlUFP8CuInlfcB dwfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vcNM+AJZ8KG54Dwo0gkyYb/wKx45ruKFaN8SIBB125Y=; b=sisFN0ZUefeTkBBV2s+mEvMvPmLM3QWK7I/UrdjQBo3L0tkMm2XFQoZ8b7JVNf4+ZZ Em3+Jqze96N27FkVinPPJraU93bK4DLUymk9jY5/k8iK9w/ZL12UOw6+EG62iAfEGftX /PTl+Q/swcTn4HXvKaZ6//F6AHA98uilLyaqBwRD1WQwRoVSQjp5RthBiEtjNNxo6W49 jB0YHofK3OXyPCGs6t61e2FTE1heVVbiU2TmujGe9x5HW7nIpAr2F1gudzMxTCSWxI/+ MScnil71CSp0IebqRRffKnPIcA2QcYgTGNGi0cwygJ6WPA5j3/qHaz3KetoFUMtnJgyt nDOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZVL9n6yX; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h34si8378574pgb.48.2022.01.24.13.46.17; Mon, 24 Jan 2022 13:46:28 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=ZVL9n6yX; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1452790AbiAXV0f (ORCPT + 99 others); Mon, 24 Jan 2022 16:26:35 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:55078 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444340AbiAXVAm (ORCPT ); Mon, 24 Jan 2022 16:00:42 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 74154B8122A; Mon, 24 Jan 2022 21:00:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A07D2C340E5; Mon, 24 Jan 2022 21:00:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058039; bh=OzkQojU2CQWWU1b+Ypc3Ses6ysxsIjIUCCxdS7saOgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZVL9n6yX8EluVa/R9Be3ppbyDeGfERmbteLWX9qkeJSfBj7CDpEjBLp/BYPT6/5r0 KKNHC5LMOAJ6nuJR2QzT94WurbPxTHSrpzROIh/3O3zgI1eXqKC4TjU2TxqKMhfG7H fxhFZ7NK6heoq+GuYAh+JPcfjjTgj0NyyJT/fnAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0128/1039] media: atomisp: fix enum formats logic Date: Mon, 24 Jan 2022 19:31:57 +0100 Message-Id: <20220124184129.459538078@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mauro Carvalho Chehab [ Upstream commit fae46cb0531b45c789e39128f676f2bafa3a7b47 ] Changeset 374d62e7aa50 ("media: v4l2-subdev: Verify v4l2_subdev_call() pad config argument") added an extra verification for a pads parameter for enum mbus format code. Such change broke atomisp, because now the V4L2 core refuses to enum MBUS formats if the state is empty. So, add .which field in order to select the active formats, in order to make it work again. While here, improve error messages. Fixes: 374d62e7aa50 ("media: v4l2-subdev: Verify v4l2_subdev_call() pad config argument") Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- .../staging/media/atomisp/pci/atomisp_ioctl.c | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index a57e640fbf791..29826f8e4143d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -773,7 +773,10 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh, struct video_device *vdev = video_devdata(file); struct atomisp_device *isp = video_get_drvdata(vdev); struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; - struct v4l2_subdev_mbus_code_enum code = { 0 }; + struct v4l2_subdev_mbus_code_enum code = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + struct v4l2_subdev *camera; unsigned int i, fi = 0; int rval; @@ -783,14 +786,20 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh, return -EINVAL; } + camera = isp->inputs[asd->input_curr].camera; + if(!camera) { + dev_err(isp->dev, "%s(): camera is NULL, device is %s\n", + __func__, vdev->name); + return -EINVAL; + } + rt_mutex_lock(&isp->mutex); - rval = v4l2_subdev_call(isp->inputs[asd->input_curr].camera, pad, - enum_mbus_code, NULL, &code); + + rval = v4l2_subdev_call(camera, pad, enum_mbus_code, NULL, &code); if (rval == -ENOIOCTLCMD) { dev_warn(isp->dev, - "enum_mbus_code pad op not supported. Please fix your sensor driver!\n"); - // rval = v4l2_subdev_call(isp->inputs[asd->input_curr].camera, - // video, enum_mbus_fmt, 0, &code.code); + "enum_mbus_code pad op not supported by %s. Please fix your sensor driver!\n", + camera->name); } rt_mutex_unlock(&isp->mutex); @@ -820,6 +829,8 @@ static int atomisp_enum_fmt_cap(struct file *file, void *fh, f->pixelformat = format->pixelformat; return 0; } + dev_err(isp->dev, "%s(): format for code %x not found.\n", + __func__, code.code); return -EINVAL; } -- 2.34.1