Skip to content

Commit 66e245d

Browse files
aloktiwaij-intel
authored andcommitted
platform/x86/intel/pmt/discovery: use valid device pointer in dev_err_probe
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: d9a0788 ("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>
1 parent e44c42c commit 66e245d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/platform/x86/intel/pmt/discovery.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,9 +548,9 @@ static int pmt_features_probe(struct auxiliary_device *auxdev, const struct auxi
548548
priv->dev = device_create(&intel_pmt_class, &auxdev->dev, MKDEV(0, 0), priv,
549549
"%s-%s", "features", dev_name(priv->parent));
550550
if (IS_ERR(priv->dev))
551-
return dev_err_probe(priv->dev, PTR_ERR(priv->dev),
551+
return dev_err_probe(&auxdev->dev, PTR_ERR(priv->dev),
552552
"Could not create %s-%s device node\n",
553-
"features", dev_name(priv->dev));
553+
"features", dev_name(priv->parent));
554554

555555
/* Initialize each feature */
556556
for (i = 0; i < ivdev->num_resources; i++) {

0 commit comments

Comments
 (0)