From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 A9DC1337BA6; Fri, 13 Mar 2026 01:52:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773366758; cv=none; b=bWJBPS8KfPREp0kLu537mDxwu4OnOSy+dxpFkzRnEsTZFXA/spoeJm18t5x1UGr/wA+6FO5fmu6quNjEqr58w+d/GumJrcOBx9vkF8yAviDbaxO1bXeNnc805dVJp5hvw4PtIE2LwjGqTY6KL1eF9Mb+U4H65DXIGnDX5RszYtI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773366758; c=relaxed/simple; bh=RFMAz3gtqVPr0spLvBGURASuHF6nJbAQptgHl3lAlNs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nwBmd1OoDes6GpmcidUB4SlOtisOVdzXMTsEaRLYyId3iM9AWM3qDlTagHzxqWx/gE0ExHDFnS/+cfIgtNjeufohn9yvUVvKbEaQGLmlSgHAw9rM29N6uegIReSJn6Uk5CpM0SVzxoxjbQtIAvCAhbIRLnB28ATJKCxxDPf+4sA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mnKZWYu+; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass 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="mnKZWYu+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1773366748; x=1804902748; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RFMAz3gtqVPr0spLvBGURASuHF6nJbAQptgHl3lAlNs=; b=mnKZWYu+n8yqD5Fprg+J2nG16nW4BoVzzKqiJ2v39VqYL6OpOGGp2ZoL udH96TgiYMbNt6kVm3UwkaZJ7hLp9Kyu09kbYSXZ6bPLKEo2OGsTicIJi OwoM+7cvRUhWzJmoOFOT3OnryN7I/sa78WnjCEj1JPAGcBlmS9RmHl/QD mNyMpRuBmPZ9VRbR4RVAKZnMn7buzr/Ar9qjrCriv++Sp6Jyvbb8GgAqW WAYc9b7HJElYSolNBBALWnek7wzgZcMxGoa2IgDC8sryWzwfyaeNl4E19 bUQzwYQGnhNw8k5QFAGB7TSCB6dR4TkAwytCcRMIkdK2OU6Y40S6vjkDd g==; X-CSE-ConnectionGUID: JWv8j5c0QAWg6bASo/u8MQ== X-CSE-MsgGUID: 17wjz3fqToC+LYghWNrn3Q== X-IronPort-AV: E=McAfee;i="6800,10657,11727"; a="74354597" X-IronPort-AV: E=Sophos;i="6.23,117,1770624000"; d="scan'208";a="74354597" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2026 18:52:12 -0700 X-CSE-ConnectionGUID: ukU4FvFWTqeuDfszU6JniQ== X-CSE-MsgGUID: h4eqBIB4Req9XaOI4ac/bg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,117,1770624000"; d="scan'208";a="220108515" Received: from debox1-desk4.jf.intel.com ([10.88.27.138]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2026 18:52:12 -0700 From: "David E. Box" To: thomas.hellstrom@linux.intel.com, rodrigo.vivi@intel.com, irenic.rajneesh@gmail.com, ilpo.jarvinen@linux.intel.com, srinivas.pandruvada@linux.intel.com, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, xi.pardee@linux.intel.com Cc: david.e.box@linux.intel.com, hansg@kernel.org, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Subject: [PATCH 16/22] platform/x86/intel/pmc/ssram: Use fixed-size static pmc array Date: Thu, 12 Mar 2026 18:51:55 -0700 Message-ID: <20260313015202.3660072-17-david.e.box@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260313015202.3660072-1-david.e.box@linux.intel.com> References: <20260313015202.3660072-1-david.e.box@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Xi Pardee Switch pmc_ssram_telems from a devm-allocated pointer to a fixed-size static array, eliminating per-probe allocation overhead and simplifying lifetime management. Correspondingly simplify pmc_ssram_telemetry_get_pmc_info() validation to check devid availability and tighten input bounds checking. Drop null-pointer checks now that the storage is static. Signed-off-by: Xi Pardee Signed-off-by: David E. Box --- drivers/platform/x86/intel/pmc/ssram_telemetry.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/platform/x86/intel/pmc/ssram_telemetry.c b/drivers/pla= tform/x86/intel/pmc/ssram_telemetry.c index 1deb4d71da3f..9c3d7ba2fd52 100644 --- a/drivers/platform/x86/intel/pmc/ssram_telemetry.c +++ b/drivers/platform/x86/intel/pmc/ssram_telemetry.c @@ -24,7 +24,7 @@ =20 DEFINE_FREE(pmc_ssram_telemetry_iounmap, void __iomem *, if (_T) iounmap(_= T)) =20 -static struct pmc_ssram_telemetry *pmc_ssram_telems; +static struct pmc_ssram_telemetry pmc_ssram_telems[3]; static bool device_probed; =20 static int @@ -140,7 +140,7 @@ int pmc_ssram_telemetry_get_pmc_info(unsigned int pmc_i= dx, if (pmc_idx >=3D MAX_NUM_PMC) return -EINVAL; =20 - if (!pmc_ssram_telems || !pmc_ssram_telems[pmc_idx].devid) + if (!pmc_ssram_telems[pmc_idx].devid) return -ENODEV; =20 pmc_ssram_telemetry->devid =3D pmc_ssram_telems[pmc_idx].devid; @@ -153,12 +153,6 @@ static int pmc_ssram_telemetry_probe(struct pci_dev *p= cidev, const struct pci_de { int ret; =20 - pmc_ssram_telems =3D devm_kzalloc(&pcidev->dev, sizeof(*pmc_ssram_telems)= * MAX_NUM_PMC, - GFP_KERNEL); - if (!pmc_ssram_telems) { - ret =3D -ENOMEM; - goto probe_finish; - } =20 ret =3D pcim_enable_device(pcidev); if (ret) { --=20 2.43.0