[PATCH 2/6] platform/x86/intel/pmt/discovery: Avoid WARN for malformed tables
From: David E. Box
Date: Fri Oct 30 2026 - 21:30:02 EST
The feature table contents are supplied by the device, so an invalid table
size is an expected probe error. WARN() is not appropriate for malformed
device data because systems with panic_on_warn set will panic.
Use dev_err_probe() instead. This preserves the diagnostic and -EINVAL
return while being a better fit for the probe failure path.
Fixes: d9a078809356 ("platform/x86/intel/pmt: Add PMT Discovery driver")
Signed-off-by: David E. Box <david.e.box@xxxxxxxxxxxxxxx>
---
drivers/platform/x86/intel/pmt/discovery.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/intel/pmt/discovery.c b/drivers/platform/x86/intel/pmt/discovery.c
index 47a4def6e6b9..143d2b3be562 100644
--- a/drivers/platform/x86/intel/pmt/discovery.c
+++ b/drivers/platform/x86/intel/pmt/discovery.c
@@ -440,8 +440,9 @@ pmt_feature_get_feature_table(struct pmt_features_priv *priv,
size = sizeof(*header) + FEAT_ATTR_SIZE(header->attr_size) +
PMT_GUID_SIZE(header->num_guids);
res_size = resource_size(&res);
- if (WARN(size > res_size, "Bad table size %zu > %pa", size, &res_size))
- return -EINVAL;
+ if (size > res_size)
+ return dev_err_probe(priv->dev, -EINVAL,
+ "Bad table size %zu > %pa\n", size, &res_size);
/* Get the feature attributes, including capability fields */
tbl_offset += sizeof(*header);
--
2.43.0