All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: Alexander Deucher <Alexander.Deucher@amd.com>,
	Luben Tuikov <luben.tuikov@amd.com>,
	Maling list - DRI developers <dri-devel@lists.freedesktop.org>,
	amd-gfx list <amd-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 1/1] drm/amdgpu: Convert to using devm_drm_dev_alloc()
Date: Mon, 7 Sep 2020 10:06:08 +0200	[thread overview]
Message-ID: <20200907080608.GP2352366@phenom.ffwll.local> (raw)
In-Reply-To: <CADnq5_NRyOfP48C5w4Q87qx98-hTLQP7PsP8OhGMbXJBu_Gb4A@mail.gmail.com>

On Sat, Sep 05, 2020 at 11:50:05AM -0400, Alex Deucher wrote:
> On Thu, Sep 3, 2020 at 9:22 PM Luben Tuikov <luben.tuikov@amd.com> wrote:
> >
> > Convert to using devm_drm_dev_alloc(),
> > as drm_dev_init() is going away.
> >
> > Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
> 
> I think we can drop the final drm_put in the error case?  I think the
> unwinding in current devm code should take care of it.

Same applies for the pci remove hook too.
-Daniel
> 
> Alex
> 
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 11 +++--------
> >  1 file changed, 3 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > index 146a85c8df1c..06d994187c24 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > @@ -1142,18 +1142,13 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
> >         if (ret)
> >                 return ret;
> >
> > -       adev = kzalloc(sizeof(*adev), GFP_KERNEL);
> > -       if (!adev)
> > -               return -ENOMEM;
> > +       adev = devm_drm_dev_alloc(&pdev->dev, &kms_driver, typeof(*adev), ddev);
> > +       if (IS_ERR(adev))
> > +               return PTR_ERR(adev);
> >
> >         adev->dev  = &pdev->dev;
> >         adev->pdev = pdev;
> >         ddev = adev_to_drm(adev);
> > -       ret = drm_dev_init(ddev, &kms_driver, &pdev->dev);
> > -       if (ret)
> > -               goto err_free;
> > -
> > -       drmm_add_final_kfree(ddev, adev);
> >
> >         if (!supports_atomic)
> >                 ddev->driver_features &= ~DRIVER_ATOMIC;
> > --
> > 2.28.0.394.ge197136389
> >
> > _______________________________________________
> > amd-gfx mailing list
> > amd-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel@ffwll.ch>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: Alexander Deucher <Alexander.Deucher@amd.com>,
	Daniel Vetter <daniel@ffwll.ch>,
	Luben Tuikov <luben.tuikov@amd.com>,
	Maling list - DRI developers <dri-devel@lists.freedesktop.org>,
	amd-gfx list <amd-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 1/1] drm/amdgpu: Convert to using devm_drm_dev_alloc()
Date: Mon, 7 Sep 2020 10:06:08 +0200	[thread overview]
Message-ID: <20200907080608.GP2352366@phenom.ffwll.local> (raw)
In-Reply-To: <CADnq5_NRyOfP48C5w4Q87qx98-hTLQP7PsP8OhGMbXJBu_Gb4A@mail.gmail.com>

On Sat, Sep 05, 2020 at 11:50:05AM -0400, Alex Deucher wrote:
> On Thu, Sep 3, 2020 at 9:22 PM Luben Tuikov <luben.tuikov@amd.com> wrote:
> >
> > Convert to using devm_drm_dev_alloc(),
> > as drm_dev_init() is going away.
> >
> > Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
> 
> I think we can drop the final drm_put in the error case?  I think the
> unwinding in current devm code should take care of it.

Same applies for the pci remove hook too.
-Daniel
> 
> Alex
> 
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 11 +++--------
> >  1 file changed, 3 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > index 146a85c8df1c..06d994187c24 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > @@ -1142,18 +1142,13 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
> >         if (ret)
> >                 return ret;
> >
> > -       adev = kzalloc(sizeof(*adev), GFP_KERNEL);
> > -       if (!adev)
> > -               return -ENOMEM;
> > +       adev = devm_drm_dev_alloc(&pdev->dev, &kms_driver, typeof(*adev), ddev);
> > +       if (IS_ERR(adev))
> > +               return PTR_ERR(adev);
> >
> >         adev->dev  = &pdev->dev;
> >         adev->pdev = pdev;
> >         ddev = adev_to_drm(adev);
> > -       ret = drm_dev_init(ddev, &kms_driver, &pdev->dev);
> > -       if (ret)
> > -               goto err_free;
> > -
> > -       drmm_add_final_kfree(ddev, adev);
> >
> >         if (!supports_atomic)
> >                 ddev->driver_features &= ~DRIVER_ATOMIC;
> > --
> > 2.28.0.394.ge197136389
> >
> > _______________________________________________
> > amd-gfx mailing list
> > amd-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  reply	other threads:[~2020-09-07  8:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04  1:22 [PATCH 0/1] Convert to using devm_drm_dev_alloc() Luben Tuikov
2020-09-04  1:22 ` Luben Tuikov
2020-09-04  1:22 ` [PATCH 1/1] drm/amdgpu: " Luben Tuikov
2020-09-04  1:22   ` Luben Tuikov
2020-09-05 15:50   ` Alex Deucher
2020-09-05 15:50     ` Alex Deucher
2020-09-07  8:06     ` Daniel Vetter [this message]
2020-09-07  8:06       ` Daniel Vetter
2020-09-07  8:07       ` Daniel Vetter
2020-09-07  8:07         ` Daniel Vetter
2020-09-08 20:09         ` Luben Tuikov
2020-09-08 20:09           ` Luben Tuikov
2020-09-11 20:49           ` Luben Tuikov
2020-09-11 20:49             ` Luben Tuikov
2020-09-14 21:38             ` Alex Deucher
2020-09-14 21:38               ` Alex Deucher
2020-09-08 19:50       ` Luben Tuikov
2020-09-08 19:50         ` Luben Tuikov
2020-09-08 19:43     ` Luben Tuikov
2020-09-08 19:43       ` Luben Tuikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200907080608.GP2352366@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=Alexander.Deucher@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=luben.tuikov@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.