diff mbox series

drm/gma500: Fix error code in probe()

Message ID 20210927081628.GA10186@kili (mailing list archive)
State New, archived
Headers show
Series drm/gma500: Fix error code in probe() | expand

Commit Message

Dan Carpenter Sept. 27, 2021, 8:16 a.m. UTC
The error code is stored in "dev_priv", not "dev".  The "dev" pointer
isn't initialized yet.

Fixes: c2f17e60cbe1 ("drm/gma500: Embed struct drm_device in struct drm_psb_private")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/gpu/drm/gma500/psb_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Patrik Jakobsson Sept. 27, 2021, 8:30 a.m. UTC | #1
On Mon, Sep 27, 2021 at 10:16 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> The error code is stored in "dev_priv", not "dev".  The "dev" pointer
> isn't initialized yet.
>

Hi Dan,
This is already addressed in:
https://patchwork.kernel.org/project/dri-devel/patch/20210924094040.3631675-1-yangyingliang@huawei.com/

-Patrik

> Fixes: c2f17e60cbe1 ("drm/gma500: Embed struct drm_device in struct drm_psb_private")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.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.20.1
>
Thomas Zimmermann Sept. 27, 2021, 8:31 a.m. UTC | #2
Hi

Am 27.09.21 um 10:16 schrieb Dan Carpenter:
> The error code is stored in "dev_priv", not "dev".  The "dev" pointer
> isn't initialized yet.
> 
> Fixes: c2f17e60cbe1 ("drm/gma500: Embed struct drm_device in struct drm_psb_private")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks for the patch. There's already a fix for this bug in 
drm-misc-next. [1]

Best regards
Thomas

[1] 
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=ebe180d376a5f7b2e534b69d237aa6fab43008ee

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