[PATCH] drm/nouveau: fix compile errors

Daniel Vetter daniel at ffwll.ch
Thu Jan 26 10:30:17 UTC 2017


On Wed, Jan 25, 2017 at 12:30:40PM -0500, Rob Clark wrote:
> From: Rob Clark <rclark at redhat.com>
> 
> Perhaps some newer versions of gcc are more clever about this.
> 
> drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c: In function 'gk104_top_oneinit':
> include/linux/device.h:1164:45: error: 'inst' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>  #define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
>                                              ^

Why is maybe-unitialized an error? We've tried that with i915, it ended in
tears ...
-Daniel

> drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c:32:18: note: 'inst' was declared here
>   u32 data, type, inst;
>                   ^
> 
> Signed-off-by: Rob Clark <rclark at redhat.com>
> ---
>  drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c
> index efac340..d352bbb 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c
> @@ -29,7 +29,7 @@ gk104_top_oneinit(struct nvkm_top *top)
>  	struct nvkm_subdev *subdev = &top->subdev;
>  	struct nvkm_device *device = subdev->device;
>  	struct nvkm_top_device *info = NULL;
> -	u32 data, type, inst;
> +	u32 data, type = 0, inst = 0;
>  	int i;
>  
>  	for (i = 0; i < 64; i++) {
> -- 
> 2.9.3
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list