All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] drm/gma500: Fix wrong pointer passed to PTR_ERR()
@ 2021-09-24  9:40 Yang Yingliang
  2021-09-24  9:50 ` Thomas Zimmermann
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2021-09-24  9:40 UTC (permalink / raw)
  To: linux-kernel, dri-devel; +Cc: daniel, airlied, patrik.r.jakobsson, tzimmermann

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(-)

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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] drm/gma500: Fix wrong pointer passed to PTR_ERR()
  2021-09-24  9:40 [PATCH -next] drm/gma500: Fix wrong pointer passed to PTR_ERR() Yang Yingliang
@ 2021-09-24  9:50 ` Thomas Zimmermann
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Zimmermann @ 2021-09-24  9:50 UTC (permalink / raw)
  To: Yang Yingliang, linux-kernel, dri-devel
  Cc: daniel, airlied, patrik.r.jakobsson


[-- Attachment #1.1: Type: text/plain, Size: 1316 bytes --]

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);
> 

-- 
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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-24  9:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-24  9:40 [PATCH -next] drm/gma500: Fix wrong pointer passed to PTR_ERR() Yang Yingliang
2021-09-24  9:50 ` Thomas Zimmermann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.