Skip to contentSkip to conversation

drm/gma500: Fix wrong pointer passed to PTR_ERR()

PATCH In review Yang Yingliang 2 participants 2 messages Sep 24, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/gma500: Fix wrong pointer passed to PTR_ERR()

PTR_ERR() should access the value just tested by IS_ERR(), otherwise the wrong error code will be returned.

---
 drivers/gpu/drm/gma500/psb_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/gma500/psb_drv.c +1 -1
index 3d036d2a3b29..7a10bb39ef0b 100644
@@ -454,7 +454,7 @@ static int psb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	dev_priv = devm_drm_dev_alloc(&pdev->dev, &driver, struct drm_psb_private, dev);
 	if (IS_ERR(dev_priv))
-		return PTR_ERR(dev);
+		return PTR_ERR(dev_priv);
 	dev = &dev_priv->dev;
 
 	pci_set_drvdata(pdev, dev);
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi

Am 24.09.21 um 11:40 schrieb Yang Yingliang:

Quoted 5 lines

PTR_ERR() should access the value just tested by IS_ERR(), otherwise the wrong error code will be returned.

Indeed, thanks for the patch.

I'll add the fix with the correct Fixes tag soon.

Best regards
Thomas

Quoted 18 lines
---
  drivers/gpu/drm/gma500/psb_drv.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/gma500/psb_drv.c +1 -1
index 3d036d2a3b29..7a10bb39ef0b 100644
@@ -454,7 +454,7 @@ static int psb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
  	dev_priv = devm_drm_dev_alloc(&pdev->dev, &driver, struct drm_psb_private, dev);
  	if (IS_ERR(dev_priv))
-		return PTR_ERR(dev);
+		return PTR_ERR(dev_priv);
  	dev = &dev_priv->dev;
 
  	pci_set_drvdata(pdev, dev);
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer