Already using devm_drm_dev_init, so very simple replacment. Signed-off-by: Daniel Vetter <daniel.vetter at intel.com> Cc: Dave Airlie <airlied at redhat.com> Cc: Gerd Hoffmann <kraxel at redhat.com> Cc: Daniel Vetter <daniel.vetter at ffwll.ch> Cc: Sam Ravnborg <sam at ravnborg.org> Cc: "Noralf Tr?nnes" <noralf at tronnes.org> Cc: Rob Herring <robh at kernel.org> Cc: Thomas Zimmermann <tzimmermann at suse.de> Cc: virtualization at lists.linux-foundation.org Cc: Emil Velikov <emil.velikov at collabora.com> --- drivers/gpu/drm/cirrus/cirrus.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/cirrus/cirrus.c b/drivers/gpu/drm/cirrus/cirrus.c index a36269717c3b..4b65637147ba 100644 --- a/drivers/gpu/drm/cirrus/cirrus.c +++ b/drivers/gpu/drm/cirrus/cirrus.c @@ -567,18 +567,13 @@ static int cirrus_pci_probe(struct pci_dev *pdev, return ret; ret = -ENOMEM; - cirrus = kzalloc(sizeof(*cirrus), GFP_KERNEL); - if (cirrus == NULL) - return ret; + cirrus = devm_drm_dev_alloc(&pdev->dev, &cirrus_driver, + struct cirrus_device, dev); + if (IS_ERR(cirrus)) + return PTR_ERR(cirrus); dev = &cirrus->dev; - ret = devm_drm_dev_init(&pdev->dev, dev, &cirrus_driver); - if (ret) { - kfree(cirrus); - return ret; - } dev->dev_private = cirrus; - drmm_add_final_kfree(dev, cirrus); cirrus->vram = devm_ioremap(&pdev->dev, pci_resource_start(pdev, 0), pci_resource_len(pdev, 0)); -- 2.25.1
Den 03.04.2020 15.58, skrev Daniel Vetter:> Already using devm_drm_dev_init, so very simple replacment. > > Signed-off-by: Daniel Vetter <daniel.vetter at intel.com> > Cc: Dave Airlie <airlied at redhat.com> > Cc: Gerd Hoffmann <kraxel at redhat.com> > Cc: Daniel Vetter <daniel.vetter at ffwll.ch> > Cc: Sam Ravnborg <sam at ravnborg.org> > Cc: "Noralf Tr?nnes" <noralf at tronnes.org> > Cc: Rob Herring <robh at kernel.org> > Cc: Thomas Zimmermann <tzimmermann at suse.de> > Cc: virtualization at lists.linux-foundation.org > Cc: Emil Velikov <emil.velikov at collabora.com> > ---Acked-by: Noralf Tr?nnes <noralf at tronnes.org>
On Fri, Apr 03, 2020 at 03:58:23PM +0200, Daniel Vetter wrote:> Already using devm_drm_dev_init, so very simple replacment. > > Signed-off-by: Daniel Vetter <daniel.vetter at intel.com> > Cc: Dave Airlie <airlied at redhat.com> > Cc: Gerd Hoffmann <kraxel at redhat.com> > Cc: Daniel Vetter <daniel.vetter at ffwll.ch> > Cc: Sam Ravnborg <sam at ravnborg.org> > Cc: "Noralf Tr?nnes" <noralf at tronnes.org> > Cc: Rob Herring <robh at kernel.org> > Cc: Thomas Zimmermann <tzimmermann at suse.de> > Cc: virtualization at lists.linux-foundation.org > Cc: Emil Velikov <emil.velikov at collabora.com>Acked-by: Sam Ravnborg <sam at ravnborg.org>> --- > drivers/gpu/drm/cirrus/cirrus.c | 13 ++++--------- > 1 file changed, 4 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/cirrus/cirrus.c b/drivers/gpu/drm/cirrus/cirrus.c > index a36269717c3b..4b65637147ba 100644 > --- a/drivers/gpu/drm/cirrus/cirrus.c > +++ b/drivers/gpu/drm/cirrus/cirrus.c > @@ -567,18 +567,13 @@ static int cirrus_pci_probe(struct pci_dev *pdev, > return ret; > > ret = -ENOMEM; > - cirrus = kzalloc(sizeof(*cirrus), GFP_KERNEL); > - if (cirrus == NULL) > - return ret; > + cirrus = devm_drm_dev_alloc(&pdev->dev, &cirrus_driver, > + struct cirrus_device, dev); > + if (IS_ERR(cirrus)) > + return PTR_ERR(cirrus); > > dev = &cirrus->dev; > - ret = devm_drm_dev_init(&pdev->dev, dev, &cirrus_driver); > - if (ret) { > - kfree(cirrus); > - return ret; > - } > dev->dev_private = cirrus; > - drmm_add_final_kfree(dev, cirrus); > > cirrus->vram = devm_ioremap(&pdev->dev, pci_resource_start(pdev, 0), > pci_resource_len(pdev, 0)); > -- > 2.25.1 > > _______________________________________________ > dri-devel mailing list > dri-devel at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel