[v2,06/10] drm/bochs: Allocate DRM device in struct bochs_device
Thomas Zimmermann
tzimmermann at suse.de
Fri Oct 4 07:16:53 UTC 2024
Hi
Am 02.10.24 um 22:00 schrieb Kees Bakker:
> Op 02-09-2024 om 12:53 schreef Thomas Zimmermann:
>> Allocate an instance of struct drm_device in struct bochs_device. Also
>> remove all uses of dev_private from bochs and upcast from the embedded
>> instance if necessary.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
>> Acked-by: Gerd Hoffmann <kraxel at redhat.com>
>> ---
>> drivers/gpu/drm/tiny/bochs.c | 52 +++++++++++++++++-------------------
>> 1 file changed, 25 insertions(+), 27 deletions(-)
>>
>> [...]
>> @@ -606,6 +602,7 @@ static const struct dev_pm_ops bochs_pm_ops = {
>> static int bochs_pci_probe(struct pci_dev *pdev, const struct
>> pci_device_id *ent)
>> {
>> + struct bochs_device *bochs;
>> struct drm_device *dev;
>> unsigned long fbsize;
>> int ret;
>> @@ -620,9 +617,10 @@ static int bochs_pci_probe(struct pci_dev *pdev,
>> const struct pci_device_id *ent
>> if (ret)
>> return ret;
>> - dev = drm_dev_alloc(&bochs_driver, &pdev->dev);
>> - if (IS_ERR(dev))
>> + bochs = devm_drm_dev_alloc(&pdev->dev, &bochs_driver, struct
>> bochs_device, dev);
>> + if (IS_ERR(bochs))
>> return PTR_ERR(dev);
>> + dev = &bochs->dev;
> The assignment of dev comes after potential use of dev in PTR_ERR(dev).
> Did you perhaps meant to have PTR_ERR(&pdev->dev) ?
Thanks for reporting. That should return PTR_ERR(bochs).
Best regards
Thomas
>> ret = pcim_enable_device(pdev);
>> if (ret)
>> @@ -630,7 +628,7 @@ static int bochs_pci_probe(struct pci_dev *pdev,
>> const struct pci_device_id *ent
>> pci_set_drvdata(pdev, dev);
>> - ret = bochs_load(dev);
>> + ret = bochs_load(bochs);
>> if (ret)
>> goto err_free_dev;
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
More information about the dri-devel
mailing list