From patchwork Sun Jan 19 14:39:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13944482 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EECDC1EEE6 for ; Sun, 19 Jan 2025 14:39:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737297584; cv=none; b=rGuk0tArNkFCVQxyUkfd+stb/ORounzVC+oapOloKtlO6oRY1SYlR5T6PJbWDzoTJI3He2ktV9KbR5hSkfF9gTcEe7uur+9X0W0p+RwR6KEq8XYAQeEkmMR2a+vUPglyn0UPV0YHD2mZWCyGVwvaeQwlFs4iHbM3shSOt9si0QU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737297584; c=relaxed/simple; bh=KDOrt8yMbSdXUf9l9jC4PhmTthFsTt7OFWdxL+XcPvA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RElIBQCDAXbqDrOs2tcXZasj7UpapdnXa6h1tAM/I5nRq7NmnMbmfUpHA9DTo0h2ANfag22F6vv4TsCpP5RDL60X6yxvn+FOO9/4s6a8R9gs/sZ1BniBzC4OyalF2xCVjBnnDPSLcims0cuNnA+0SFbWPA5bfGD8XlKzKWqtRmQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=RfQkSVJG; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="RfQkSVJG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737297583; x=1768833583; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KDOrt8yMbSdXUf9l9jC4PhmTthFsTt7OFWdxL+XcPvA=; b=RfQkSVJGmZQ9+Vy/VmbXAIU+nnjAQ5vDWmWgxv5Y4ZTNI5De2nv9HRnU ug3v2FWaBKVyRLjHpV/HkFzGsk9Bn+YA8WtKsVotBcM6kT5K1hZcFtXaM sdF+dEbum8hFa4v04kAlc995qvxJO9GBgs8LPGNaDbmMPS6LGlrcBM1F1 Ptsqb493PQCGzP0j9r7bVGlImnxQSvO8NfVFqjyB3MOAILsIrTWNQ2Tpv mmj3vsBbXusTf9+eZErytjVX9ibHajQQpAfzYUmu/SjDOyLTLsCtxfQHf zehrVUBkTJU6srqzvhFH7kHxAVssiz7CzanS2m2Mf5LnZhV7mmPNZ+It+ A==; X-CSE-ConnectionGUID: C35KA2ktSs26MnhcxTI99A== X-CSE-MsgGUID: RBUzgCdnRvqTsM/svrK4Fw== X-IronPort-AV: E=McAfee;i="6700,10204,11314"; a="49086273" X-IronPort-AV: E=Sophos;i="6.12,310,1728975600"; d="scan'208";a="49086273" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2025 06:39:43 -0800 X-CSE-ConnectionGUID: 4OauoFlTTHeefYFP5NwFHw== X-CSE-MsgGUID: 0eKd7BdxQruno8aWbUvI4A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="106701522" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jan 2025 06:39:36 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 255AC1202AB; Sun, 19 Jan 2025 16:39:30 +0200 (EET) Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo From: Sakari Ailus To: linux-media@vger.kernel.org Cc: Benjamin Mugnier , Sylvain Petinot , Yong Zhi , Dan Scally , Jacopo Mondi , hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, bingbu.cao@intel.com, Tianshu Qiu , Maxime Ripard , Rui Miguel Silva , Martin Kepplinger , Purism Kernel Team , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Robert Foss , Todor Tomov , Bryan O'Donoghue , Tomi Valkeinen , Raspberry Pi Kernel Maintenance , Florian Fainelli , Broadcom internal kernel review list , Maxime Coquelin , Alexandre Torgue , Benoit Parrot , Ricardo Ribalda , "Duc-Long, Le" Subject: [PATCH v9 6/9] media: v4l: Memset argument to 0 before calling get_mbus_config pad op Date: Sun, 19 Jan 2025 16:39:01 +0200 Message-Id: <20250119143904.114991-7-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250119143904.114991-1-sakari.ailus@linux.intel.com> References: <20250119143904.114991-1-sakari.ailus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Memset the config argument to get_mbus_config V4L2 sub-device pad operation to zero before calling the operation. This ensures the callers don't need to bother with it nor the implementations need to set all fields that may not be relevant to them. Signed-off-by: Sakari Ailus --- drivers/media/v4l2-core/v4l2-subdev.c | 2 ++ include/media/v4l2-subdev.h | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index cde1774c9098..a3074f469b15 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -444,6 +444,8 @@ static int call_enum_dv_timings(struct v4l2_subdev *sd, static int call_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad, struct v4l2_mbus_config *config) { + memset(config, 0, sizeof(*config)); + return check_pad(sd, pad) ? : sd->ops->pad->get_mbus_config(sd, pad, config); } diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 2f2200875b03..57f2bcb4eb16 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -822,7 +822,9 @@ struct v4l2_subdev_state { * possible configuration from the remote end, likely calling * this operation as close as possible to stream on time. The * operation shall fail if the pad index it has been called on - * is not valid or in case of unrecoverable failures. + * is not valid or in case of unrecoverable failures. The + * config argument has been memset to 0 just before calling + * the op. * * @set_routing: Enable or disable data connection routes described in the * subdevice routing table. Subdevs that implement this operation