Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wsometimes-uninitialized in drivers/gpu/drm/stm/ltdc.c #1575

Closed
nathanchance opened this issue Feb 2, 2022 · 4 comments
Closed

-Wsometimes-uninitialized in drivers/gpu/drm/stm/ltdc.c #1575

nathanchance opened this issue Feb 2, 2022 · 4 comments
Assignees
Labels
-Wsometimes-uninitialized [BUG] linux-next This is an issue only seen in linux-next [FIXED][LINUX] development cycle This bug was only present and fixed in a -next or -rc cycle

Comments

@nathanchance
Copy link
Member

drivers/gpu/drm/stm/ltdc.c:625:2: warning: variable 'val' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
        default:
        ^~~~~~~
drivers/gpu/drm/stm/ltdc.c:635:2: note: uninitialized use occurs here
        val |= LxPCR_YCEN;
        ^~~
drivers/gpu/drm/stm/ltdc.c:600:9: note: initialize the variable 'val' to silence this warning
        u32 val;
               ^
                = 0
1 warning generated.

Reported upstream: https://lore.kernel.org/r/Yfq3XwozrxYaFhgD@dev-arch.archlinux-ax161/

@nathanchance nathanchance added [BUG] linux-next This is an issue only seen in linux-next -Wsometimes-uninitialized Reported upstream This bug was filed on LLVM’s issue tracker, Phabricator, or the kernel mailing list. labels Feb 2, 2022
@nathanchance nathanchance self-assigned this Feb 2, 2022
@nathanchance
Copy link
Member Author

@nathanchance nathanchance added [PATCH] Submitted A patch has been submitted for review and removed Reported upstream This bug was filed on LLVM’s issue tracker, Phabricator, or the kernel mailing list. labels Feb 7, 2022
fengguang pushed a commit to 0day-ci/linux that referenced this issue Feb 22, 2022
Clang warns:

  drivers/gpu/drm/stm/ltdc.c:625:2: warning: variable 'val' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
          default:
          ^~~~~~~
  drivers/gpu/drm/stm/ltdc.c:635:2: note: uninitialized use occurs here
          val |= LxPCR_YCEN;
          ^~~
  drivers/gpu/drm/stm/ltdc.c:600:9: note: initialize the variable 'val' to silence this warning
          u32 val;
                 ^
                  = 0
  1 warning generated.

Use a return instead of break in the default case to fix the warning.
Add an error message so that this return is not silent, which could hide
issues in the future.

Fixes: 484e72d ("drm/stm: ltdc: add support of ycbcr pixel formats")
Link: ClangBuiltLinux#1575
Acked-by: Yannick Fertre <yannick.fertre@foss.st.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
@nathanchance
Copy link
Member Author

@nathanchance
Copy link
Member Author

@nathanchance nathanchance added [PATCH] Accepted A submitted patch has been accepted upstream and removed [PATCH] Submitted A patch has been submitted for review labels Feb 25, 2022
@nathanchance
Copy link
Member Author

Patch is now available in next-20220307: https://git.kernel.org/next/linux-next/c/3b2f68f196a5b23c61777078f5c7d0d19626b5e4

@nathanchance nathanchance added [FIXED][LINUX] development cycle This bug was only present and fixed in a -next or -rc cycle and removed [PATCH] Accepted A submitted patch has been accepted upstream labels Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Wsometimes-uninitialized [BUG] linux-next This is an issue only seen in linux-next [FIXED][LINUX] development cycle This bug was only present and fixed in a -next or -rc cycle
Projects
None yet
Development

No branches or pull requests

1 participant