]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/drm_file: fix use of uninitialized variable
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Fri, 3 Nov 2023 13:14:03 +0000 (15:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Feb 2024 07:42:11 +0000 (08:42 +0100)
[ Upstream commit 1d3062fad9c7313fff9970a88e0538a24480ffb8 ]

smatch reports:

drivers/gpu/drm/drm_file.c:967 drm_show_memory_stats() error: uninitialized symbol 'supported_status'.

'supported_status' is only set in one code path. I'm not familiar with
the code to say if that path will always be ran in real life, but
whether that is the case or not, I think it is good to initialize
'supported_status' to 0 to silence the warning (and possibly fix a bug).

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231103-uninit-fixes-v2-1-c22b2444f5f5@ideasonboard.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/drm_file.c

index 537e7de8e9c33520ff1c5812623b9a23ccdd3826..93da7b5d785bef49b9f83925f200461b203d8ab6 100644 (file)
@@ -411,7 +411,7 @@ int drm_open(struct inode *inode, struct file *filp)
 {
        struct drm_device *dev;
        struct drm_minor *minor;
-       int retcode;
+       int retcode = 0;
        int need_setup = 0;
 
        minor = drm_minor_acquire(iminor(inode));