diff mbox series

[-next] drm/gma500: Fix wrong pointer passed to PTR_ERR()

Message ID 20210924094040.3631675-1-yangyingliang@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next] drm/gma500: Fix wrong pointer passed to PTR_ERR() | expand

Commit Message

Yang Yingliang Sept. 24, 2021, 9:40 a.m. UTC
PTR_ERR() should access the value just tested by IS_ERR(),
otherwise the wrong error code will be returned.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/gpu/drm/gma500/psb_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Zimmermann Sept. 24, 2021, 9:50 a.m. UTC | #1
Hi

Am 24.09.21 um 11:40 schrieb Yang Yingliang:
> PTR_ERR() should access the value just tested by IS_ERR(),
> otherwise the wrong error code will be returned.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

Indeed, thanks for the patch.

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

Best regards
Thomas

> ---
>   drivers/gpu/drm/gma500/psb_drv.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
> index 3d036d2a3b29..7a10bb39ef0b 100644
> --- a/drivers/gpu/drm/gma500/psb_drv.c
> +++ b/drivers/gpu/drm/gma500/psb_drv.c
> @@ -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);
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index 3d036d2a3b29..7a10bb39ef0b 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -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);