From patchwork Mon Jan 20 11:01:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13945006 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 156091991CD for ; Mon, 20 Jan 2025 11:02:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737370957; cv=none; b=DBX8pF1orZsqEQ/jNKXycr8s/ryfNF+96qh8Z7GiJ9Dk92iuz60JxRrIvigiW60AEwE7Lols5spUrhdOGJ3QYgfiZYTc+oMO3x4wjCek630GWmI5bKly59XfjKXu4bCCq7RB5UBznXNP4A3SqQp0geiOxJABQQhe3MsOZURuRxg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737370957; c=relaxed/simple; bh=KDOrt8yMbSdXUf9l9jC4PhmTthFsTt7OFWdxL+XcPvA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AzwRhifPn53Qv4/3tMe/x+q490+apqiKXuXYBtMXaHjNdHkCYwf8e8U+SYWcPG90DMVMUYqcSFmELen36gJmZFD7o1aQ64oL6JFBJye73zwtbJMxeUx9MjOBtN3A+kjA3H4jhxAv6Mfiqwtv/uramfALVUBkgm5OOfXB2qi1OmY= 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=iHjSOUJ2; arc=none smtp.client-ip=192.198.163.12 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="iHjSOUJ2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1737370956; x=1768906956; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KDOrt8yMbSdXUf9l9jC4PhmTthFsTt7OFWdxL+XcPvA=; b=iHjSOUJ2FLhBaXCxDm1A2TspktRMkEAW/onJtdLddJuxfwjNWj9auand 0zEaLFBkw6Whm8NoUhTTiafdihUE/X26wBP0iJXzl4u8t+1HzIY43ygs2 O6U8ou+rF9hU4hYdsYEMVF5OsLqrxf9+aBkE2waRgaqeIj0Yo68HxHe0U 8KDeMOXtWnwyrRIFTlDtXCA+V9kprudxJD4jGXmSUUp/5KcmFdt/jkqx0 k7uEAujJi3A++RUbrAoR1+VszkJc6AfVGXnC/KlB9rg7fPadhQ5ESqRMd WK4v3NBVGuG3K0waCv4kcYJHx7w5bTgH1itMF+geOdDTAoqr56Q6rne6K A==; X-CSE-ConnectionGUID: 0sVUVthZQe+BvhXD+L8EmA== X-CSE-MsgGUID: 5vUj05NlRXC6CMWCRah4qQ== X-IronPort-AV: E=McAfee;i="6700,10204,11320"; a="41680332" X-IronPort-AV: E=Sophos;i="6.13,218,1732608000"; d="scan'208";a="41680332" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2025 03:02:35 -0800 X-CSE-ConnectionGUID: xT4ctzbARHCQ3SmrsQ1TUA== X-CSE-MsgGUID: CgOOMSHvTlCacdlTCmZA9A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,218,1732608000"; d="scan'208";a="106606506" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2025 03:02:28 -0800 Received: from svinhufvud.intel.com (maa-artisokka.localdomain [192.168.240.50]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 731B911FAB1; Mon, 20 Jan 2025 13:02:22 +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 v10 6/9] media: v4l: Memset argument to 0 before calling get_mbus_config pad op Date: Mon, 20 Jan 2025 13:01:54 +0200 Message-Id: <20250120110157.152732-7-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250120110157.152732-1-sakari.ailus@linux.intel.com> References: <20250120110157.152732-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