[PATCH 14/19] drm: ->agp_init can't fail

David Herrmann dh.herrmann at gmail.com
Sun Nov 3 06:12:26 PST 2013


Hi Daniel

On Sun, Nov 3, 2013 at 2:31 PM, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
> Thanks to the removal of REQUIRE_AGP we can use a void return value
> and shed a bit of complexity.
>
> Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
>  drivers/gpu/drm/drm_pci.c  | 3 +--
>  drivers/gpu/drm/drm_stub.c | 7 ++-----
>  include/drm/drmP.h         | 2 +-
>  3 files changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
> index 2b0d7deb4b6d..3bd8b3fc6189 100644
> --- a/drivers/gpu/drm/drm_pci.c
> +++ b/drivers/gpu/drm/drm_pci.c
> @@ -262,7 +262,7 @@ static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p)
>         return 0;
>  }
>
> -static int drm_pci_agp_init(struct drm_device *dev)
> +static void drm_pci_agp_init(struct drm_device *dev)
>  {
>         if (drm_core_has_AGP(dev)) {
>                 if (drm_pci_device_is_agp(dev))
> @@ -274,7 +274,6 @@ static int drm_pci_agp_init(struct drm_device *dev)
>                                 1024 * 1024);
>                 }
>         }
> -       return 0;
>  }
>
>  static void drm_pci_agp_destroy(struct drm_device *dev)
> diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
> index 047d1d1fb0e1..dea432b2dfcf 100644
> --- a/drivers/gpu/drm/drm_stub.c
> +++ b/drivers/gpu/drm/drm_stub.c
> @@ -502,11 +502,8 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
>
>         mutex_lock(&drm_global_mutex);
>
> -       if (dev->driver->bus->agp_init) {
> -               ret = dev->driver->bus->agp_init(dev);
> -               if (ret)
> -                       goto out_unlock;
> -       }
> +       if (dev->driver->bus->agp_init)
> +               dev->driver->bus->agp_init(dev);

Ok, technically, you need to remove "out_unlock" here. But patch #16
removes err_agp and reused out_unlock, so I think this is fine.

Reviewed-by: David Herrmann <dh.herrmann at gmail.com>

Thanks
David

>
>         if (drm_core_check_feature(dev, DRIVER_MODESET)) {
>                 ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL);
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 0ae0f58e1988..df502c292ef8 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -749,7 +749,7 @@ struct drm_bus {
>                           struct drm_unique *unique);
>         int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
>         /* hooks that are for PCI */
> -       int (*agp_init)(struct drm_device *dev);
> +       void (*agp_init)(struct drm_device *dev);
>         void (*agp_destroy)(struct drm_device *dev);
>
>  };
> --
> 1.8.4.rc3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list