platform/x86/intel/pmt: Add PMT Discovery driver
Hello David E. Box,
Commit d9a078809356 ("platform/x86/intel/pmt: Add PMT Discovery driver") from Jul 2, 2025 (linux-next), leads to the following Smatch static checker warning:
drivers/platform/x86/intel/pmt/discovery.c:551 pmt_features_probe() error: 'priv->dev' dereferencing possible ERR_PTR()
drivers/platform/x86/intel/pmt/discovery.c
531 static int pmt_features_probe(struct auxiliary_device *auxdev, const struct auxiliary_device_id *id)
532 {
533 struct intel_vsec_device *ivdev = auxdev_to_ivdev(auxdev);
534 struct pmt_features_priv *priv;
535 size_t size;
536 int ret, i;
537
538 size = struct_size(priv, feature, ivdev->num_resources);
539 priv = devm_kzalloc(&auxdev->dev, size, GFP_KERNEL);
540 if (!priv)
541 return -ENOMEM;
542
543 priv->parent = &ivdev->pcidev->dev;
544 auxiliary_set_drvdata(auxdev, priv);
545
546 priv->dev = device_create(&intel_pmt_class, &auxdev->dev, MKDEV(0, 0), priv,
547 "%s-%s", "features", dev_name(priv->parent));
548 if (IS_ERR(priv->dev))
549 return dev_err_probe(priv->dev, PTR_ERR(priv->dev),
550 "Could not create %s-%s device node\n",
--> 551 "features", dev_name(priv->dev));
^^^^^^^^^^^^^^^^^^^priv->dev is an error pointer so we can't print the driver name. I considered changing this code to:
return dev_err_probe(priv->dev, PTR_ERR(priv->dev), "Could not create features device node\n");
But I decided it sounds like a typo. People likely won't understand that "features" is the name of the device.
552
553 /* Initialize each feature */
554 for (i = 0; i < ivdev->num_resources; i++) {
555 struct feature *feature = &priv->feature[priv->count];
556 regards,
dan carpenter