]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
platform/x86/intel/pmt/discovery: use valid device pointer in dev_err_probe
authorAlok Tiwari <alok.a.tiwari@oracle.com>
Wed, 24 Dec 2025 09:51:09 +0000 (01:51 -0800)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 29 Dec 2025 15:22:44 +0000 (17:22 +0200)
The PMT feature probe creates a child device with device_create().
If device creation fail, the code pass priv->dev (which is an ERR_PTR)
to dev_err_probe(), which is not a valid device pointer.

This patch change the dev_err_probe() call to use the parent auxiliary
device (&auxdev->dev) and update the error message to reference the
parent device name. It ensure correct error reporting and avoid
passing an invalid device pointer.

Fixes: d9a078809356 ("platform/x86/intel/pmt: Add PMT Discovery driver")
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Link: https://patch.msgid.link/20251224095133.115678-1-alok.a.tiwari@oracle.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/intel/pmt/discovery.c

index 9c5b4d0e1fae6862707458f5455018bb1f5d5f81..e500aa327d23747df493bd6aec9d8e6d7eafdd57 100644 (file)
@@ -548,9 +548,9 @@ static int pmt_features_probe(struct auxiliary_device *auxdev, const struct auxi
        priv->dev = device_create(&intel_pmt_class, &auxdev->dev, MKDEV(0, 0), priv,
                                  "%s-%s", "features", dev_name(priv->parent));
        if (IS_ERR(priv->dev))
-               return dev_err_probe(priv->dev, PTR_ERR(priv->dev),
+               return dev_err_probe(&auxdev->dev, PTR_ERR(priv->dev),
                                     "Could not create %s-%s device node\n",
-                                    "features", dev_name(priv->dev));
+                                    "features", dev_name(priv->parent));
 
        /* Initialize each feature */
        for (i = 0; i < ivdev->num_resources; i++) {