]> git.ipfire.org Git - people/arne_f/kernel.git/commit
drm/nouveau: hide gcc-4.9 -Wmaybe-uninitialized
authorArnd Bergmann <arnd@arndb.de>
Mon, 24 Oct 2016 15:30:38 +0000 (17:30 +0200)
committerSasha Levin <alexander.levin@microsoft.com>
Sun, 4 Mar 2018 15:28:32 +0000 (10:28 -0500)
commit21633c4d20dab18549e5763bc86466cf1083b293
tree4b149cfc88737a2a8ac18cca3a17e6074096df77
parent27a77d9d7a0f3dad998d6e7a2d5fd3fea3ace685
drm/nouveau: hide gcc-4.9 -Wmaybe-uninitialized

[ Upstream commit b74c0a9969f25217a5e5bbcac56a11bee16718d3 ]

gcc-4.9 notices that the validate_init() function returns unintialized
data when called with a zero 'nr_buffers' argument, when called with the
-Wmaybe-uninitialized flag:

drivers/gpu/drm/nouveau/nouveau_gem.c: In function ‘validate_init.isra.6’:
drivers/gpu/drm/nouveau/nouveau_gem.c:457:5: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

However, the only caller of this function always passes a nonzero
argument, and gcc-6 is clever enough to take this into account and
not warn about it any more.

Adding an explicit initialization to -EINVAL here is correct even if
the caller changed, and it avoids the warning on gcc-4.9 as well.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-By: Karol Herbst <karolherbst@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
drivers/gpu/drm/nouveau/nouveau_gem.c